Idea of this post is not to compare performance of browsers. I included results of most fastest libraries in all major browsers to compare how they behave in different environments and to check if any library doesn't have serious performance gaps in any browsers. From results you will see that nothing really changes on different platforms.
First of all lets examine performance of top 9 libraries in all browsers. Last chart will include 2 libraries that left (nmrugg-LZMA-JS and olle-lz77-kit). I left them for the end because they are veryyy slow in comparsion to others. So most interesting results will be clearly visible on charts.
Performance in Chrome:
Our speed champion is jslzjb. It most fastest compression algorithm and it looks like time required to compress bigger data scales linearly to the data size. However it's average compression level is only 55-60%. So this library make sense to use only if you need to slightly reduce amount of data and do it fast.
The best results in speed/compression is provided by dankogaj-js-deflate library. It's average compression ratio is 15%-30% and it doing compression only a bit slower then jslzjb lib. However this library has quite huge code base: Non minified compression script has 54K size. Note: another deflate library is slower even if they code base look the same.
Third place is taken by rozetta-LZW lib. It's very small has similar compression ratio as deflate algorithms and performing compression only a bit slower then deflate dankogaj-js-deflate.
Performance in Firefox:
In Firefox situation is different. LZW libraries (rozetta-lzw) works faster then Deflate on all data sizes. However jslzjb results are still not reachable.
Performance in Internet Explorer:
In IE situation is similar to chrome about algorithms speed. However from results we can see that positions of LZW libraries is now different. It looks like sawJS-LZW is better optimized for IE it's compressing data with the same speed as deflate algorithms.
Performance of other libraries in Chrome:
In this chart you can see enormous amount of time required to perform compression by nmrugg-LZMA-JS and olle-lz77-kit. Memory sizes they require during compression is also huge. Chrome process with test page took up to 200Mb of memory to compress the data.
I think it make sense to use them only if you have another background thread (WebWorkers, extensions). Also nmrugg-LZMA-JS provide slightly better compression then Deflate or LZW libraries.
Performance of Deflate libraries (different compression level)
In all previous results deflate libraries was using default compression level: 6. In this chart you can see performance difference between different levels. Increasing compression level also significally increasing time required to compress the data. If you are going to choose deflate choose wisely compression level.
Summary:
Assuming all results for myself I created following recommendations:
- Choose jslzjb - if performance is a key and only twice smaller data is fine.
- Choose rozetta-LZW - if size of scripts most important
- Choose dankogai-js-deflate - if performance and compression is most important
In the next post I will add additional criteria to this list. As experiments showed if you want to integrate libraries with other platforms and operate with international data - everything becomes more complicated then performance/size/compression.
Previous Post: Compression ratio tests
Starting Post: Libraries and Test conditions
Next Post: Integration of Deflate libraries with other platforms.
Previous Post: Compression ratio tests
Starting Post: Libraries and Test conditions
Next Post: Integration of Deflate libraries with other platforms.
No comments:
Post a Comment