theangryangel/XI4N

Evaluating arraybuffers (Was: Switch to jspack-arraybuffer)

Closed this issue · 4 comments

Nodejs now supports ArrayBuffers, Dataviews, etc. This makes it feasible to get rid of jspack and switch to jspack-arraybuffer which uses native Dataview.

Depends on jspack-arraybuffer being tested and packaged for node.

d0f7fb4 switches to jspack-arraybuffer, although as yet untested due to offline rewrite.

Tested and working as of db3a93c however changes in node v0.10 to buffer and arraybuffers may result in more memory used and more garbage collection required - may need to port across to the native buffers API :(

A Buffer object can also be used with typed arrays. The buffer object is cloned to an ArrayBuffer that is used as the backing store for the typed array. The memory of the buffer and the ArrayBuffer is not shared.
NOTE: Node.js v0.8 simply retained a reference to the buffer in array.buffer instead of cloning it.
While more efficient, it introduces subtle incompatibilities with the typed arrays specification. ArrayBuffer#slice() makes a copy of the slice while Buffer#slice() creates a view.

jspack-buffers created. Same API. As of f405d85 we now use that, rather than jspack-arraybuffers, given node v0.10 changes.

👍 👍