Skip to content

buffer: improve Buffer.concat([])

Rodrigo Muino Tomonari requested to merge github/fork/JacksonTian/buff_zero into v1.x

When i do benchmark testing with Buffer.concat(), found that Buffer.concat([]) is even slower than Buffer.concat([buf]).

The reason is Buffer.concat([]) must create new Buffer(0) every time. So create one const Buffer(0), and return the same Buffer.

This change improve Buffer.concat([]) speed about ~80 times.

Merge request reports

Loading