3 ms·
What use cases are there for minifying SVG? It never struck me as something that was large enough to be worth compressing its filesize in any way. It's the CPU/
by vortico 9y ago
What use cases are there for minifying SVG? It never struck me as something that was large enough to be worth compressing its filesize in any way. It's the CPU/GPU that you usually want to worry about, since only a few characters can cause a lot of time to be spent drawing the frame.
- garethrees 9y agoThe case for reducing the size of SVG is the same as for any kind of web asset: it reduces the initial transmission time (and improves the likelihood of a cache hit) and so reduces the time taken to load the page. I doubt if it's worthwhile squeezing the last couple of bytes of gzip compression out of an image (other than as a fun and informative exercise), but when programmatically generating SVGs it's easy to do so naïvely and in these cases you can get big savings in file size. Here's a worked example where I was able reduce a generated image to about 17% of its original size through simple fixes: http://garethrees.org/2013/08/02/svg/ http://garethrees.org/2013/08/02/svg/ Similarly, tools like Inkscape need to represent information for editing the image (such as its layer or grouping structure; or style information maintained on a per-object basis) which is not necessary for displaying it, and this can amount to a large proportion of the SVG file size.