Commit 59dac01e authored by Trevor Norris's avatar Trevor Norris
Browse files

buffer: optimize common encoding cases

String#toLowerCase() is incredibly slow and was costing a 15-30%
performance hit for Buffers less than 1KB. Now instead it'll attempt to
find the correct encoding directly from the passed encoding, only then
afterwards it'll lowercase.

The optimization for not passing any encoding at all is still at the top
of the method.

At most this may add 10% performance hit for passing a mixed case
encoding.
parent 204228b5
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