Comments (15)
If you've patched the lib, can you make a jsperf out of it (against the current release version) ?
from lz-string.
Haven't implemented those changes currently. I'll see what I can do in my spare time when I'm off for Christmas, though.
from lz-string.
ok, thanks. Let us know.
from lz-string.
Just saw another slight tweak that I'll test out when I get to the rest of this. "context_w = String(context_c);" creates a string object instead of a string literal, which is going to be slower to work with. I'll try changing it to "context_w = '' + context_c;" to get around that.
from lz-string.
Alright, made a jsperf for it. The results seem about even, though I have IE11, so I'm not sure if this is really accurate, but it's slightly faster in IE9 mode, and a lil bit faster than that in IE8 mode.
http://jsperf.com/lz-string-performance-enhancement-test
from lz-string.
Thanks for the jsperf. These changes seem to be slightly beneficial to some browser while neutral to others (slightly negative for IE8 but it's IE8 so I quite don't care). In other words it looks good. I'm waiting until tomorrow in order to be able to test this on Windows to make sure I can't find a browser with a negative impact.
from lz-string.
Ah, my bad, I was reading the JSPerf backwards... So it looks like your changes are faster on IE8, neutral on IE>8 and Firefox but slower on Chrome and Safari. Doesn't look good... Unless I'm mistaken once more that is ;-)
from lz-string.
well, the changes were meant to be of benefit to older engines. newer ones are fast enough that it doesn't really matter that much. actually, IIRC, chrome is optimized to handle loops based on string/array length more efficiently. Though, I began wondering after the fact if string length is ever actually recalculated. strings should be immutable, so there'd never be a need to recalculate it like an array does...
from lz-string.
Did you change something on the jsperf? Results are very different this morning... The modified code runs consistently faster than the original one on pretty much all platforms...
from lz-string.
I haven't changed anything to either the jsperf or the library since I posted it. Odd that it should choose to act differently.
from lz-string.
The modified version is 24% slower for me on Chromium 40.
from lz-string.
interesting. I'm not sure how it would've had that much of an effect in any browser, either positive or negative.
from lz-string.
Maybe that's because you are using the master version of lz-string and it got updated? And you haven't rebased your changes.
from lz-string.
Admittedly, I haven't messed with this since the original conversation. It's probably irrelevant at this point.
from lz-string.
Closing this issue. The performance gain wasn't clear or significant and we're going to move toward greater gains with ES6 stuff for newer browsers
from lz-string.
Related Issues (20)
- Crash with large strings when running on Hermes (React Native)
- Is there a way to allow custom dictionaries? HOT 9
- How to realize that only specified characters are allowed to appear in the compression result? HOT 1
- LZ-String port to current typescript HOT 9
- Tag for v1.5.0 HOT 2
- Version 2 TODO list HOT 15
- Feature request: compress to source-compatible character set HOT 1
- New port for a linux executable HOT 1
- Can utf-8 codes be avoided in the output? HOT 10
- `decompressFromBase64` can return `null` HOT 7
- Docs: JSPerf.com links are no longer valid
- Docs: A Complete Demo for various compression/decompression HOT 3
- Docs: TSDoc HOT 3
- License Inconsistencies HOT 5
- Community Question: Breaking Changes and Version 2! HOT 10
- [email protected] build with warnings HOT 4
- Feature request: a non minified js file as a result of building v2 HOT 2
- Chrome virus warning with compressToEncodedURIComponent URL HOT 2
- CLI support for decompressing base64 encoded files HOT 1
- Please investigate the slow (irresponsible) LZString issue in Edge HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lz-string.