Even when I remove all rendering and just run the Go WASM in a web worker, 
like this:

    const go = new Go();
    WebAssembly.instantiateStreaming(fetch("web2600.wasm"), 
go.importObject).then((result) => {
        go.run(result.instance);
    });

The binary is still performing a long way below native performance. I'm 
writing to the web console with println() to indicate progress but apart 
from that there is no communication between Go and the browser.

I haven't looked into RequestAnimationFrames yet but I did try the Ebiten 
option. The profile looks similar to the Doom profile (with 
RequestAnimationFrames) but even then the emulation is running slower than 
native.

Worth emphasising that in the case of my Ebiten version, exactly the same 
Go code is being compiled for native CPU and WASM.

My next step (which won't be for a few days at least) is to learn a bit 
more about WebAssembly and to take a look at the code that's being 
generated.


On Wednesday, 8 September 2021 at 03:47:42 UTC+1 da...@suarezhouse.net 
wrote:

> Did moving rendering to the browser side (just have the other side prep 
> the data to be rendered) solve for the difference?  how much?  Did he do 
> the same in the Doom article to get it to OK? 
>
> On 09/07/2021 8:34 AM Stephen Illingworth <stephen.i...@gmail.com> wrote: 
>
>
> Yes. I'm seeing a 10x difference in speed too. So at least I know I'm not 
> doing anything fundamentally wrong. It's a general problem at the moment. 
>
> Thanks. 
> On Tuesday, 7 September 2021 at 09:31:41 UTC+1 ma...@eliasnaur.com wrote: 
>
> In my experience (Gio projects), WASM is very slow compared to native 
> code; my investigations are part of #32591. You may find 
> https://github.com/golang/go/issues/32591#issuecomment-517835565 
> relevant, because I cut out rendering to eliminate the JS<=>Go crossing 
> overhead. It was a ~10x difference in 2019 and I don't think anything major 
> has changed since then. 
>
> Elias 
>
>
> -- 
> You received this message because you are subscribed to a topic in the 
> Google Groups "golang-nuts" group. 
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/golang-nuts/N10hzvkDA1A/unsubscribe. 
> To unsubscribe from this group and all its topics, send an email to 
> golang-nuts...@googlegroups.com. 
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/golang-nuts/6893845f-894b-4546-bb3e-f811e61c01ben%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/golang-nuts/6893845f-894b-4546-bb3e-f811e61c01ben%40googlegroups.com?utm_medium=email&utm_source=footer>.
>  
>
>
>
> Sincerely,
>
> David Suarez
>
> Gallup Strengths Finder:  Achiever * Strategic * Relator * Ideation * 
> Learner
>
> https://www.linkedin.com/in/davidjsuarez/ 
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/9ac08e0e-337e-4220-9274-b3aee4db4fe1n%40googlegroups.com.

Reply via email to