2 ms·
Node.js Buffers are actually built on top of V8's Uint8Array. Using 32-bit integers to represent 8-bit values seems quite wasteful.
by mjor 14y ago
Node.js Buffers are actually built on top of V8's Uint8Array. Using 32-bit integers to represent 8-bit values seems quite wasteful.
- tantalor 14y agoSource please? The docs say a Buffer is "outside the V8 heap".
- mjor 14y agoYes, the chunk of memory is managed by node, but each Buffer instance is linked with a slice of the heap through `v8::Object->SetIndexedPropertiesToExternalArrayData()`, the same way a JS `Uint8Array` would. Here's the relevant link: https://github.com/joyent/node/blob/master/src/node_buffer.cc#L707 https://github.com/joyent/node/blob/master/src/node_buffer.c....