icecoder / ICEcoder

Browser code editor awesomeness
http://icecoder.net
Other
1.42k stars 347 forks source link

Compress contents before sending #493

Closed mattpass closed 8 years ago

mattpass commented 9 years ago

To further boost save and load file processes, look to compress content before transmitting data.

Rather than zip/unzip (which may need significant libs to work), just compress content as strings.

This library seems well tested and performs well compared to LZ. Key factors to consider are 100% reliability, compression and time needed to compress.

http://pieroxy.net/blog/pages/lz-string/index.html

mattpass commented 9 years ago

The JS lib seems to work great and I can get a 20kb file saved in around 450ms, instead of about 500ms. However, the PHP component seems to have issues which means I can't decode it and use at the other end. May have to drop this idea unless I can look into something more established such as lz77 compression on both JS and PHP sides, eg: https://github.com/olle/lz77-kit

mattpass commented 9 years ago

This is a good idea, but will need more looking into before implementing. As we've switched the save system to XHR and need to let the dust settle there first, plus that brings a good speed improvement, I will leave this for after v5.

LoganGray commented 9 years ago

hmmm... Since this is essentially a web app, wouldn't this really be solved by ensuring that the apache server has enabled Gzip and/or the DEFLATE (mod_deflate) directive is enabled?

mattpass commented 9 years ago

Yeah, could be, but am considering those without the server knowledge or access (eg shared hosting).

mattpass commented 9 years ago

See notes here re compression and the issues I raised with LZ String PHP https://github.com/nullpunkt/lz-string-php/issues/3#issuecomment-98890573

mattpass commented 8 years ago

OK, today added LZ compression on strings now the PHP based lib has been redone. Done and closing.