Background:
I had a chance to perform investigation of JavaScript based compression. In this investigation I tried to
compare Compression, Decompression and Integration with other platforms (like Java) of all libraries I was able to find.
Current post contain libraries overview and test conditions. Next posts will contain actual result of compression, decompression and integration:
compare Compression, Decompression and Integration with other platforms (like Java) of all libraries I was able to find.
Current post contain libraries overview and test conditions. Next posts will contain actual result of compression, decompression and integration:
- Compression ratio
- Compression performance
- Integration of compression librearies with other platforms
- Decompression performance
- Decompression on other platforms
Test conditions:
Tests was performed on following system:
Tests was performed on following system:
- OS: Windows 7 Professional SP1 (64bit)
- CPU: Intel Core i5 750 (2.67GHz)
- RAM: 4.0 GB
- Browsers:
- Google Chrome 16.0.912.0 dev-m
- Firefox 7.0
- IE 9.0.8112
Each library was used to perform compression/decompression 50 times. Average time required calculated for each run separately added together and divided by count. Cool-down time between runs 20ms, between libraries 100ms. Time required to setup/create library is not included in average time.
Compression ratio is calculated by dividing length of compressed data to of original data.
For tests I used 5 HTML pages cleaned from all styles, scripts and some attributes. Pages are google searches for "iphone" with 10, 20, 30, 50, 100 results per page. Each page contain English and some non ASCII characters (Russian/Ukrainian) to prove that library could successfully work with non ASCII characters. All data is loaded as JS files with non ascii characters esacped in form \u#### to prevent encoding problems during JS loading.
Bad news: Unfortunately none of the libraries right from the box could compress and then restore international data in original state.
Even simple string like: var s = "test \u043a\u0435\u043d\u0433".
cannot be processed correctly.
Good news: It is possible to convert non ASCII symbols with few modification to libraries or input string. In next posts I am going to walk through every library and describe how to do this.
JavaScript Compression libraries
During this series of posts I will compare following libraries. If you know/have more - please let me know and I will include them into tests
During this series of posts I will compare following libraries. If you know/have more - please let me know and I will include them into tests
Library Id | Library Url | Compression method | Comments |
---|---|---|---|
dankogai-js-deflate | Link | Deflate | This library support different compression level. However on levels 1-3 it is not able to decompress it's own produced data |
onicios-deflate | Link | Deflate | The same validation problem as above. Also code looks very similar (it have the same variables, methods) but work with different speed. So it looks like both alghoritms was simple code convertion from other language but with different optimizations. |
Stuck-jszip | Link | Zip (with Deflate inside) | This library is usnig 'onicios-deflate' lib to compress content but have it's own wrappers to produce ZIP compatible format and allow to compress several files. It is not able to decompress ZIP files |
hiddentao-lzw-async | Link | LZW | Provide Async interface of LZW compression/decompression. Have integration with node.js |
lzwjs | Link | LZW | Custom implementation of LZW algorithms. Using some fancy In/Out Streams to compress decompress data. |
rozetta-lzw | Link | LZW | Wiki like page which has examples of LZW implementation for different languages. |
saw-JS_LZW | Link | LZW | Nothing special |
jsend | Link | LZW (with additional wrappers) | Require JQuery. Able only to compress data. Decompression on other platform availabale only in php. Doesn't have decompression method in JavaScript |
nmrugg-LZMA-JS | Link | LZMA | Node.js integration. Support WebWorkers (for background compression). |
olle-lz77-kit | Link | LZ77 | Library contain code for other platforms also. Very slow |
JSXCompressor | Link | ZLIB (Deflate) | Allow only decompression in JavaScript |
Next posts will include detailed information about compression decompression and integration with other platforms
Next Post: Compression ratio tests
This comment has been removed by the author.
ReplyDelete