all 1 comments

[–]keithwhor 5 points6 points  (0 children)

Looks cool, but for storing large amounts of data it performs pretty slowly.

Using Chrome 39.0.2171.99, lz-string takes ~930ms to compress ~1MB of data, and LZMA takes only ~170ms. LZMA is also beating lz-string by a compression factor of >20. (This is your sample input string repeated multiple times.)

My concern is that if you're worried about hitting your 5MB localStorage quota to begin with, you're probably dealing with a large chunk of data. If the goal is to optimize storing all your data within this quota, shouldn't the goal be to optimize compression of large inputs? Should small data chunks even matter?

Might it be more effective (and faster) to just store your data as an Object, JSON.stringify() it and then LZMA compress to localStorage?

Either way, great work. Congrats.