On Friday, December 26, 2014 11:15:50 PM UTC-5, // ravi wrote:
>
> Given that offsets are 0-indexed and [end] is the end offset, shouldn’t 
> that default to buffer.length - 1? Digging through node/lib/buffer.js to 
> smalloc, I see: 
>
>
`end` is the ending offset (not inclusive).

P.S: given that the new buffer references the same memory, I am assuming 
> this is an extremely cheap operation. True? 
>
>
It doesn't allocate memory, but it does have to create a new Buffer object 
(to represent the slice). Doing so does not come without some cost, but in 
most cases this overhead does not cause problems. Performance issues are 
likely to be elsewhere before Buffer instantiation becomes your bottleneck.

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/1373181b-b66d-4274-908c-771a0ec03e01%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to