Re: [nodejs] When using Buffers, do the read methods also use the same initial Buffer heap memory?

2012-05-15 Thread billywhizz
the read methods are looking at the same memory. they just index into a v8 array that is wrapped around the raw memory buffer for convenience and speed of access. having said that, there are a lot of asserts and checks in the read* methods so i'd imagine they introduce quite a lot of overhead. a

Re: [nodejs] When using Buffers, do the read methods also use the same initial Buffer heap memory?

2012-05-15 Thread Ryan Cole
Yea, I meant the buf.readUInt32BE and friends. Thanks, Ryan -- Job Board: http://jobs.nodejs.org/ Posting guidelines: 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 post to this gro

Re: [nodejs] When using Buffers, do the read methods also use the same initial Buffer heap memory?

2012-05-15 Thread Ben Noordhuis
On Tue, May 15, 2012 at 11:35 PM, Ryan Cole wrote: > I'm writing a module that parses data as it comes in from a tcp socket. When > reading out data from a Buffer, is it better to stick to the slice method > because of the fact that it uses the same heap memory as the initial Buffer? Yes. > Do t

[nodejs] When using Buffers, do the read methods also use the same initial Buffer heap memory?

2012-05-15 Thread Ryan Cole
I'm writing a module that parses data as it comes in from a tcp socket. When reading out data from a Buffer, is it better to stick to the slice method because of the fact that it uses the same heap memory as the initial Buffer? Do the read methods do this, as well? I've just assumed that the re