Karsten, Awesome, I'll give it a try today.
Have you found support for this to be consistent in all (major) browsers? I am assuming this works in both directions to/from the worker. We have been waiting several years for FF to support web sockets in workers, the last one to do so. Even IE had it early on - big surprise. caniuse.com only goes so far in their assessment of support for some of the corner cases or combinations of features. Thanks for the update! I'm looking forward to exploring more of your excellent work. Alan -- *"Whatever you can do, or dream you can do, begin it. Boldness has genius, power, and magic in it. Begin it now."* - *Goethe* On May 4, 2016, at 5:34 AM, Karsten Schmidt <[email protected]> wrote: Hi Alan, in my tests I found that using buffer transfer is pretty much immediate (0-2ms) whereas using copies goes up to ~30-40ms (for a 10MB data buffer) - not the end of the world, but big difference when using workers for in a realtime context (e.g. animation). In addition to your message object you only need to specify another array of which objects to transfer, the onmessage handler stays the same... ;; send (let [buf (.-buffer (js/Uint8Array. 1e7))] (.postMessage worker #js [buf] #js [buf])) Maybe important to point out: You can't transfer a typed array directly, only its underlying ArrayBuffer. After transfer the entire typed array will be unusable by the sender. Any writes to it will fail silently and reads will produce `undefined`... Hth! On 2 May 2016 at 22:28, Alan Moore <[email protected]> wrote: Nice work Karsten! I'm especially curious about your experience with moving typed arrays between web workers and the main thread. We use workers for limited purposes now but would like to expand it to include pulling image content from a web socket - now that web sockets inside workers are recently/finally supported in FF. Alan On Sunday, May 1, 2016 at 5:54:29 PM UTC-7, Karsten Schmidt wrote: Hi everyone, last week I taught 3-day workshop about the above topics and thought some of you might be interested in this workshop report: https://medium.com/@thi.ng/workshop-report-hi-perf-clojurescript-with-webgl-asm-js-and-emscripten-a545cca083bc The source code of the various examples/exercises is available here (a README will be added in the next few days): https://github.com/thi-ng/ws-ldn-8/ -- Karsten Schmidt http://postspectacular.com | http://thi.ng -- Karsten Schmidt http://postspectacular.com | http://thi.ng | http://toxiclibs.org -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups "ClojureScript" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/clojurescript.
