Skip to content

Commit

Permalink
Revise docs for Highway (libvips#3711)
Browse files Browse the repository at this point in the history
  • Loading branch information
kleisauke authored Oct 12, 2023
1 parent 74adb39 commit 2f9ce1f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
22 changes: 11 additions & 11 deletions doc/How-it-works.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,18 +109,18 @@ set of mechanisms to copy image areas by just adjusting pointers. Most of
the time no actual copying is necessary and you can perform operations on
large images at low cost.
**Run-time code generation**
**SIMD optimisations**
VIPS uses
<ulink url="https://gstreamer.freedesktop.org/modules/orc.html">Orc</ulink>, a
run-time compiler, to generate code for some operations. For example, to
compute a convolution on an 8-bit image, VIPS will examine the convolution
matrix and the source image and generate a tiny program to calculate the
convolution. This program is then "compiled" to the vector instruction set
for your CPU, for example SSE3 on most x86 processors.
VIPS uses
<ulink url="https://github.com/google/highway">Highway</ulink>, a
C++ library, to optimise various operations with SIMD/vector
instructions. These optimised code paths are flexible and can adapt to
different instruction sets, including those with 'scalable' vectors
(size unknown at compile time). At runtime, dynamic dispatch selects
the best available implementation based on the processor's capabilities,
ensuring optimal performance.
Run-time vector code generation typically speeds operations up by a factor
of three or four.
SIMD typically speeds operations up by a factor of three or four.
**Joining operations together**
Expand Down Expand Up @@ -229,7 +229,7 @@ time you call an operation, VIPS searches the cache for a previous call to
the same operation with the same arguments. If it finds a match, you get
the previous result again. This can give a huge speedup.
By default, VIPS caches the last 1,000 operation calls. You can also control
By default, VIPS caches the last 100 operation calls. You can also control
the cache size by memory use or by files opened.
(\* Some vips operations DO have side effects, for example,
Expand Down
8 changes: 4 additions & 4 deletions doc/How-it-works.xml
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,13 @@ g_object_unref(region);
Like most threaded image processing systems, all VIPS operations have to be free of side-effects. In other words, operations cannot modify images, they can only create new images. This could result in a lot of copying if an operation is only making a small change to a large image so VIPS has a set of mechanisms to copy image areas by just adjusting pointers. Most of the time no actual copying is necessary and you can perform operations on large images at low cost.
</para>
<para>
<emphasis role="strong">Run-time code generation</emphasis>
<emphasis role="strong">SIMD optimisations</emphasis>
</para>
<para>
VIPS uses <ulink url="https://gstreamer.freedesktop.org/modules/orc.html">Orc</ulink>, a run-time compiler, to generate code for some operations. For example, to compute a convolution on an 8-bit image, VIPS will examine the convolution matrix and the source image and generate a tiny program to calculate the convolution. This program is then <quote>compiled</quote> to the vector instruction set for your CPU, for example SSE3 on most x86 processors.
VIPS uses <ulink url="https://github.com/google/highway">Highway</ulink>, a C++ library, to optimise various operations with SIMD/vector instructions. These optimised code paths are flexible and can adapt to different instruction sets, including those with <quote>scalable</quote> vectors (size unknown at compile time). At runtime, dynamic dispatch selects the best available implementation based on the processor’s capabilities, ensuring optimal performance.
</para>
<para>
Run-time vector code generation typically speeds operations up by a factor of three or four.
SIMD typically speeds operations up by a factor of three or four.
</para>
<para>
<emphasis role="strong">Joining operations together</emphasis>
Expand Down Expand Up @@ -191,7 +191,7 @@ g_object_unref(region);
Because VIPS operations are free of side-effects*, you can cache them. Every time you call an operation, VIPS searches the cache for a previous call to the same operation with the same arguments. If it finds a match, you get the previous result again. This can give a huge speedup.
</para>
<para>
By default, VIPS caches the last 1,000 operation calls. You can also control the cache size by memory use or by files opened.
By default, VIPS caches the last 100 operation calls. You can also control the cache size by memory use or by files opened.
</para>
<para>
(* Some vips operations DO have side effects, for example, <literal>vips_draw_circle()</literal> will draw a circle on an image. These operations emit an <quote>invalidate</quote> signal on the image they are called on and this signal makes all downstream operations and caches drop their contents.)
Expand Down

0 comments on commit 2f9ce1f

Please sign in to comment.