Hacker News new | ask | show | jobs
by franciscop 1748 days ago
Agreed! Not a fair comparison either way; if I compare Cash' addClass then it doesn't really "do anything" besides call the other method, so I'd say the toggleClass is representative of _the 3 methods together_, so 1/3rd? It's nice code :)

Shaving off 1kb out of 6kb of optimized GZIP code is probably impossible unless you missed something important.

I also went deep into optimizing Umbrella JS, it does a lot less than Cash so hence it's a lot smaller as well; but I went so far as comparing the GZIP output of calling `for ()` vs `forEach`, etc:

https://medium.com/@fpresencia/understanding-gzip-size-836c7...

That's why I am not concerned of repeating e.g. `function() {}` (instead of the, back then, experimental () => {}) many times, since with gzip in my experience that gets all totally abstracted out.

Edit: edited the original, explaining that Cash it's doing it nicely!

1 comments

> but I went so far as comparing the GZIP output of calling `for ()` vs `forEach`, etc

AFAIK Google Closure Compiler [1] does similar things automagically.

[1] https://github.com/google/closure-compiler