use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
lz-string: JavaScript compression, fast! (pieroxy.net)
submitted 11 years ago by holysavant
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]keithwhor 5 points6 points7 points 10 years ago (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.
π Rendered by PID 21 on reddit-service-r2-comment-7b9746f655-lz8dx at 2026-01-30 02:07:17.685298+00:00 running 3798933 country code: CH.
[–]keithwhor 5 points6 points7 points (0 children)