/plushcap/analysis/cloudflare/doubling-the-speed-of-jpegtran

Doubling the speed of jpegtran with SIMD

What's this blog post about?

At CloudFlare, efforts are made to accelerate customer websites by reducing image sizes using open source tools like jpegtran, gifsicle and pngcrush. However, these tools can be computationally expensive. Recently, it was noticed that ten times more time is spent "polishing" jpeg images compared to PNGs. The performance of pngcrush was improved by using a supercharged version of zlib. Next, the focus shifted to optimizing jpegtran (part of libjpeg distribution). Using profiling tools like Linux perf utility, it was found that 83.5% of time is spent in just two functions - encode_mcu_AC_refine and encode_mcu_AC_first. Both these functions deal with Huffman coding of the jpeg image. Optimizations were made using SIMD (Single Instruction Multiple Data) instructions, resulting in a 2.25X speedup for the test image. Further optimizations are planned to improve performance further.

Company
Cloudflare

Date published
Oct. 8, 2015

Author(s)
Vlad Krasnov

Word count
1474

Language
English

Hacker News points
117


By Matt Makai. 2021-2024.