Commit 3f65916f authored by Ben Noordhuis's avatar Ben Noordhuis
Browse files

buffer: optimize Buffer.prototype.toString('hex')

Move the implementation to C++ land. The old JS implementation used
string concatenation, was dog slow and consumed copious amounts of
memory for large buffers. Example:

  var buf = Buffer(0x1000000);  // 16 MB
  buf.toString('hex')           // Used 3+ GB of memory.

The new implementation operates in O(n) time and space.

Fixes #4700.
parent c7c1ed01
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment