You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Starting from the beginning:
I create a complicated structure, optimized for fast display in an ArrayBuffer. Roughly 100Mbytes. User input causes the code to do computations against the structure and present results on WebGL. Because the structure is so optimized - and I use WebAssembly - I can get good response times.
However, the process for building the structure takes a while and is about to take much longer. I would like to delegate the "structure creation" code to a Web Worker. The user can then do things while the structure is being built. When it is complete, the ArrayBuffer is passed to the main thread and the user can do even more things. Yay!!
But I don't know how to put the existing ArrayBuffer into a WebAssembly.Memory in the main thread. I can do a copy in Javascript but I seriously dislike that option.
Lil help please!
The text was updated successfully, but these errors were encountered:
You want to create the WebAssembly.Memory, get its buffer as an ArrayBuffer, and deal with that. The reason is that WebAssembly memories often use over-allocation to generate better WebAssembly code, which regular ArrayBuffer doesn't do. The design doesn't allow creating WebAssembly.Memory from ArrayBuffer on purpose 😄
I will note that I read issue #1162 and was left feeling confused and pessimistic.
FWIW: To use WebAssembly today with only one Memory, I wrote elaborate WebAssembly code with pages, directories, address ranges, etc. . . . basically application-specific memory management. There are logically six tables inside one array. One can do a lot with one Memory if you are sufficiently motivated.
Is there a way to do this?
Starting from the beginning:
I create a complicated structure, optimized for fast display in an ArrayBuffer. Roughly 100Mbytes. User input causes the code to do computations against the structure and present results on WebGL. Because the structure is so optimized - and I use WebAssembly - I can get good response times.
However, the process for building the structure takes a while and is about to take much longer. I would like to delegate the "structure creation" code to a Web Worker. The user can then do things while the structure is being built. When it is complete, the ArrayBuffer is passed to the main thread and the user can do even more things. Yay!!
But I don't know how to put the existing ArrayBuffer into a WebAssembly.Memory in the main thread. I can do a copy in Javascript but I seriously dislike that option.
Lil help please!
The text was updated successfully, but these errors were encountered: