On Fri, Oct 5, 2012 at 8:59 AM, Jimb Esser <[email protected]> wrote: > Ah, yeah, it does now! We wrote our module back on node 0.4, which, I > think, did not have typed arrays. That being said, it seems TypedArrays do > not support un-aligned views (e.g. if you're reading a stream and want to > read a F64 at byte offset 3, it throws an exception), as well they > shouldn't, as that's not guaranteed to be efficient cross-platform, though > is critical to performance in our specific situation. Also, it doesn't seem > you can make a typed array view off of a Buffer (or get an ArrayBuffer off > of a network read?), so that involves some copying, although since creating > views is a native call and a bit expensive, we found it quickest to copy any > network-received Buffer into one that already has views created anyway.
First-class support for ArrayBuffers and typed arrays in general is something we want to add eventually (no fixed date though). 0.8.x supports creating typed arrays from Buffer objects: var buf = new Buffer(16); var arr = new Int32Array(buf, 4); // offset, defaults to 0 The buffer size and offset need to be multiples of the type size (4 for Int32Array, 8 for a Float64Array, etc.). The typed array is a view of the buffer, i.e. it's zero-copy. -- 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
