buffer: construct Uint8Array in JS
authorTrevor Norris <trev.norris@gmail.com>
Mon, 14 Sep 2015 22:31:10 +0000 (16:31 -0600)
committerJeremiah Senkpiel <fishrock123@rocketmail.com>
Wed, 16 Sep 2015 15:41:00 +0000 (11:41 -0400)
commit7df018a29bf7619d8d979d0db821d97f16e5550f
tree9416b0348996fdb9ce6bfe4a2b759c26b969c8d9
parent431bf74c5550a7c15ada1d99b4b1bdefd6bbb86b
buffer: construct Uint8Array in JS

Overall construction time of Typed Arrays is faster in JS, but the
problem with using it normally is zero-fill of memory. Get around this
by using a flag in the ArrayBuffer::Allocator to trigger when memory
should or shouldn't be zero-filled.

Remove Buffer::Create() as it is no longer called.

The creation of the Uint8Array() was done at each callsite because at
the time of this patch there was a performance penalty for centralizing
the call in a single function.

PR-URL: https://github.com/nodejs/node/pull/2866
Reviewed-By: Fedor Indutny <fedor@indutny.com>
lib/buffer.js
src/env-inl.h
src/env.h
src/node.cc
src/node_buffer.cc
src/node_internals.h