feross / buffer

The buffer module from node.js, for the browser.
Other
1.8k stars 234 forks source link

Use TextDecoder for Buffer.toString? #268

Open cmdcolin opened 4 years ago

cmdcolin commented 4 years ago

I have some pretty large buffers (~45MB) I'm decoding, and they can create a large "GC pressure"

With TextDecoder start: 42ms

With buffer.toString() start: 838.85302734375ms

I know there have been discussions about TextEncoder/TextDecoder in the past, but thought I'd mention the performance boost here

gsvarovsky commented 4 years ago

Linking to #60 for reference

feross commented 4 years ago

I'm open to merging a PR that switches to TextDecoder. If you would like to see it implemented, please send a pull request!