Commit 5396baf7 authored by Jackson Tian's avatar Jackson Tian Committed by James M Snell
Browse files

buffer: faster case for create Buffer from new Buffer(0)

When create Buffer from a Buffer will copy data
from old to new even though length is zero.

This patch can improve edge case 4x faster.
following is benchmark results.

new: buffers/buffer_zero.js n=1024: 2463.53891
old: buffers/buffer_zero.js n=1024: 618.70801

PR-URL: https://github.com/nodejs/node/pull/4326


Reviewed-By: default avatarBen Noordhuis <info@bnoordhuis.nl>
Reviewed-By: default avatarColin Ihrig <cjihrig@gmail.com>
Reviewed-By: default avatarJames M Snell <jasnell@gmail.com>
parent 26a82971
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