Comments (5)
0.1.26 published. Thanks!
from msgpack-lite.
Note: benchmarking things on my own, I found that building strings by simply concatenating to a string via +=
operator is faster than creating a preallocated array and calling String.fromCharCode.apply
.
from msgpack-lite.
building strings by simply concatenating to a string via += operator is faster than creating a preallocated array and calling String.fromCharCode.apply.
Really!?!? I was pretty surprised with this!
https://github.com/feross/buffer/blob/master/index.js#L997
Buffer shim is also use the same String.fromCharCode.apply
technique still.
I guess that buffer-lite.js
on the master branch creates two Arrays at least on toString
. It may cost. Building/parsing string would give the most impact for decoding/encoding performance. I'd love to see it in depth.
Thanks for the great patch anyway.
from msgpack-lite.
Note: the benchmarks I was running for this were on Node 6.3 and Chrome Canary 54, so take it with a big grain of salt, different browsers might vary.
For longer stings (>~128) if your buffer happens to be Uint8Array
, the absolutely fastest string decoding you can get is by passing a Uint8Array#subarray
to TextDecoder#decode
- it's comparable in performance to using Buffer#toString
in Node.js, and beats JSON.parse
. The threshold is whatever the cost there is to initialize a new TypedArray, which seems to always be in the range of 100 - 500 ns on my hardware for whatever reason, even when using already allocated ArrayBuffer
.
from msgpack-lite.
Hope it be fixed
from msgpack-lite.
Related Issues (20)
- Require cycle: node_modules/msgpack-lite/lib... HOT 1
- question: how would I en/decode js set type?
- usemaps gives undefined instead
- docs: msgpack-lite is much more efficient for large strings HOT 1
- decode only first item HOT 1
- here is the CDN:
- how to decode 4 digit buffers. HOT 1
- Slow moving, would funding help? HOT 1
- es modules for modern apps
- better error message - BUFFER_SHORTAGE HOT 2
- Is it possible for msgpack-lite to decode data as it is streamed in?
- use native array.isArray instead
- Report amount of decoded data HOT 1
- Discrepancy for binary keys between browser and nodejs
- Compression issues with large Inputs HOT 4
- Unable to serialise maps and UInt8Arrays at the same time HOT 3
- BigInt / BigInt64Array / BigUInt64Array HOT 2
- encoding number types should not use both Int and Float families
- [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead. HOT 2
- Some tests fails when minified by [email protected] HOT 3
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 msgpack-lite.