operasoftware/jsunzip — pull request #4 by mattgodbolt (2014-03-27 03:11:36+00:00)
Title: Various Chrome/Firefox speedups

Hi,

As discussed on email these are my changes. Tested on Firefox 27.0.1 and Chrome 33 on Linux only.

I had to fix up the line-ending fixes to work for UNIX line endings.

Timings before/after on my 2.4GHz Core i5 laptop (fastest of 3 runs):
Before:
Firefox : 104ms. 26393.3 kB/s
Chrome : 634ms. 4329.5 kB/s

After:
Firefox : 83ms. 33071.2 kB/s
Chrome : Uncompressed cantrbry.zip in 52ms. 52786.7 kB/s

Usability:
To get best performance, the input data should be provided as a Uint8Array. If it's passed as a string, it'll be converted to a Uint8Array. To get binary data out as a Uint8Array, use readBinary(), which is fastest. Else use read() (as before) to get a string out.

The simple test uses the string APIs throughout. The performance test uses the binary, but also compares the string against the binary result when verifying.

My biggest concern is that this doesn't work on IE as I can't test it.

Hope it's useful!

- matt