On Thu, Oct 4, 2012 at 6:19 PM, Jimb Esser <[email protected]> wrote:
> If you want *really* fast buffer access for larger integer types and float
> types, you can set up a native module that calls
> SetIndexedPropertiesToExternalArrayData a few times on your Buffer and gives
> you a native indexed view into the buffer for whatever primitive type you
> want to read (much, much, much faster than trying to read a float
> byte-by-byte and assemble it).  We do this in our internal networking
> buffers, and got quite a speed-up compared to combining bytes in JS (though
> either are *way* faster than calling into native methods to do the read,
> except maybe with floats).  Note: for un-aligned reads (e.g. reading a
> 64-bit float from 3 bytes within a buffer), I think this only works on some
> platforms, but those platforms include x86 and x64, which is all we care
> about in our case.

You don't have to drop down to C++ for that, node.js supports typed
arrays[1]. I probably should have mentioned that in my other post. :-)

[1] https://developer.mozilla.org/en-US/docs/JavaScript_typed_arrays

-- 
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 group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to