You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<title>If you can, use <literal>thumbnail</literal>, not <literal>resize</literal></title>
18
18
<para>
19
-
The <literal>thumbnail</literal> operation combines load and resize into one step. This lets it take advantage of format library features, such as shrink on load, and can lead to a large improvement in speed and drop in memory use.
19
+
The <literal>thumbnail</literal> operation combines load and resize into one step. This lets it take advantage of format library features, such as shrink on load, and can lead to a large improvement in speed and a large drop in memory use.
Now it’s 68 MB of memory and 0.08s – half the memory use, and 3x faster. In fact the improvement is better than that, since the `<literal>vips</literal> command takes a while to start and needs a fair amount of memory:
43
+
Now it’s 68 MB of memory and 0.08s – half the memory use, and 3x faster. In fact the improvement is better than that, since the <literal>vips</literal> command takes a while to start and needs a fair amount of memory:
This is a hint you pass to <literal>new_from_file</literal> and friends that signals that you will only scan this image in the direction that the underlying load library supports. This can give a useful improvement in speed and reduction in memory use in many cases.
66
66
</para>
67
67
<para>
68
-
See <linkxlink:href="How-it-opens-files.html">the <quote>How it opens files</quote></link> chapter for background on this feature.
68
+
See <linkxlink:href="How-it-opens-files.html">the <quote>How it opens files</quote> chapter</link> for background on this feature.
libvips is demand-driven, and uses <emphasis>partial images</emphasis> as intermediates. This means you can construct long pipelines of image processing operations, they won’t use much memory, and they’ll (usually) join efficiently.
74
+
libvips is demand-driven, and uses partial images as intermediates. This means you can construct long pipelines of image processing operations, they won’t use much memory, and they’ll (usually) join efficiently.
75
75
</para>
76
76
<para>
77
-
libvips is <emphasis>horizontally threaded</emphasis>, meaning that threads run along the pipeline of operations you are evaluating, not up and down images. This means that libvips can (usually) parallelise longer pipelines more efficiently than short ones.
77
+
libvips is horizontally threaded, meaning that threads run along the pipeline of operations you are evaluating, not up and down images. This means that libvips can (usually) parallelise longer pipelines more efficiently than short ones.
78
78
</para>
79
79
<para>
80
80
If you can, aim for long pipelines of processing operations.
81
81
</para>
82
82
</refsect3>
83
+
<refsect3xml:id="cache-commonly-reused-images">
84
+
<title>Cache commonly reused images</title>
85
+
<para>
86
+
If an image is reused repeatedly in one pipeline, it’ll be recomputed each time. You can sometimes get a big speedup by keeping images like this in memory rather than recalculating their pixels, see (for example), <literal>copy_memory()</literal> in pyvips.
Check for interlaced (also called progressive) images.
121
130
</para>
122
131
<para>
123
-
These are the ones that appear at a low res first, then slowly fill in detail as they are downloaded.
132
+
These are the ones that appear in low detail first, then progressively sharpen as they are downloaded.
124
133
</para>
125
134
<para>
126
135
The downside is that you don’t get the final pixels until the whole image is in memory, which prevents any streaming processing and hugely increases memory use. For example:
<title>Disable the libvips operation cache if you don’t need it</title>
158
167
<para>
159
-
The libvips’ operation cache is not useful for image proxies (i.e. processing many different images). Consider disabling this with <literal>vips_cache_set_max(0);</literal>.
168
+
The libvips operation cache is not useful for image proxies (i.e. processing many different images). Consider disabling this with <literal>vips_cache_set_max(0);</literal>.
0 commit comments