-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider use better deflate/inflate #102
Comments
This looks very cool! |
pako's master is ready for release. Could you take a look? May be, you have some requests or recommendations about api? |
I tested pako in JSZip and the integration was easy : I just had to replace the Regarding the size of the generated file, it gained 40% (minified/gzipped) :
The huge difference in the first line ("original) comes from zlibjs which is The "without any DEFLATE code" column is what I get when I comment almost Almost 9KB minified/gzipped is bigger than zlib.js but still far better than an I created a small benchmark with two tests :
Disclaimer : the numbers here are not really significant : I took random files
I also tested with a 136MB xml file compressed into a 2.4M file, in Firefox
The memory pressure has a clear impact here : outside the VM (with more RAM) These numbers are impressive, good work ! This looks good, even if the 40% size increase is a bit worrying. Next step for me, check more files with pako (at least, the files that caused |
@dduponchel i'm really glad, that you have good first impression about our work. A couple of comments: size That's a first "step". We had no goal to create package of minimal size. Goal was having fun with investigation v8 jit speed, and "finally" making correct and maintainable zlib port. As far as i know, jszip use something called like I think, that situation with size can be partially improved (with cutting gzip support and zlib headers support), but i don't like premature optimizations. If one say, that 5kb difference is a real pain that prevents uzing pako, i'll try reduce size. Personally, i'd prefer to avoid this, because that can affect maintainability and sync with future zlib versions (and just not interesting, LOL). speed Note, that jszip's current deflate and pako have differend defaults. zlib.js level 6 is NOT ther same as original zlib level6 (pako's results are binary equal for all variations). Try to vary processing huge files Honestly, that should not be done with one big chunk. Browser have I have no serious "browser programming" experience, and more strong with server side code design. So, you can find, that pako API is not enougth good for browsers. If you know, how to improve API - let me know, i'm open to any suggestion. |
Thanks for your reply :) I don't have any statistics but if I use the bug tracker as reference, a lot of Regarding the size, it matters on browsers. jQuery weights 35KB (minified / Regarding the speed, I was comparing what we have now (with zlib.js) and what Regarding the huge files, I know that's not a good idea. Currently the JSZip I haven't used a lot pako's API : I just added |
Well, let's wait what @Stuk says. Thanks for spending time for browser tests. I've just released pako 0.1.0, and it's now ok in npm & bower. No needs to fork master anymore. |
Thanks for the great work @puzrin, and those benchmarks look great @dduponchel. I think the only place where 5kb has any real difference nowadays is on mobile (do we have any idea how commonly JSZip is used on mobile devices?) and really, if someone needs to reduce kb then removing or optimizing images is an easier place to make savings. In short, I think the gains in speed here outweigh the slight increase in size. To me it looks like it would be fantastic to integrate pako! |
After the fix in nodeca/pako#14, I've launched the following test :
I've tested my whole filesystem, (about 400 000 files) without any error/difference. |
We a doing js port of latest zlib. Now
deflate
works, andinflate
is coming soon. https://github.com/nodeca/pako . It's written with node.js, but targeted for browsers as modern deflate/inflate implementation.Preliminary results, compared to one in js-zip:
I'll be glad if you find it useful. If you have suggestion about API - let me know.
The text was updated successfully, but these errors were encountered: