Confirmed users
716
edits
(Add benchmarks section) |
|||
Line 41: | Line 41: | ||
=== Typed Arrays for Managing Assets === | === Typed Arrays for Managing Assets === | ||
It seems that game developers would like to store assets in binary form in Typed Arrays. How possible/feasible is that? For example, can I say 'take this typed array and interpret it as a JPEG image' ? Another orthogonal question: can one cache on disk (IndexedDB?) the contents of a Typed Array? | It seems that game developers would like to store assets in binary form in Typed Arrays. How possible/feasible is that? For example, can I say 'take this typed array and interpret it as a JPEG image'? | ||
''No you can't. You can convert the data into a Blob and get a URL for that, but that involves a memory copy.'' | |||
Another orthogonal question: can one cache on disk (IndexedDB?) the contents of a Typed Array? | |||
''Yes, you can store Typed Arrays and ArrayBuffers in IndexedDB just like many other data types.'' | |||
Currently if you want to take data in a Typed Array and display in an <img> or otherwise end up interacting with the DOM, you'll have to copy the data at least once. One solution might be the ability to create a blob-url representing the contents of a Typed Array. | Currently if you want to take data in a Typed Array and display in an <img> or otherwise end up interacting with the DOM, you'll have to copy the data at least once. One solution might be the ability to create a blob-url representing the contents of a Typed Array. | ||
''Yes, we should add the ability to get a URL which represents the contents of a TypedArray/ArrayBuffer. Basically that simply means supporting a TypedArray or ArrayBuffer to URL.createObjectURL()'' | |||
=== Compression of JavaScript code === | === Compression of JavaScript code === |