I don't know how the 2D operations in the emscripten SDL shim are 
implemented versus 'native SDL', but I would actually expect massively 
different performance behaviour, since I'm seeing the same for WebGL vs 
native OpenGL, and the same might be true for HTML canvas vs whatever SDL 
is doing in the native implementing (assuming the 2D operations of the 
emscripten SDL "emulation" go through HTML canvas).

To give you an idea of how bad it is on WebGL vs GL: the "number of trivial 
drawcalls (16 byte uniform update plus glDrawArrays()) before dropping 
below 60fps" on WebGL in desktop browsers is around 5000, in a good native 
GL implementation (like NVIDIA on Windows), that number is about half a 
million (although the number varies there extremely too, e.g. Intel GPUs in 
common laptops only manage around 15k).

I would expect similar differences for your situation.

So basically: just compiling the code usually isn't enough, the code must 
also be changed for the specific performance characteristics of the web 
platform (e.g. for WebGL vs GL this means that "old school" batching tricks 
must be used to reduce the number of calls into the GL API as much as 
possible).

Cheers,
-Floh.

On Monday, 24 February 2020 23:05:23 UTC+1, Rob Probin wrote:
>
> I've been using Emscripten with SDL2 to do some 2D game work. I wrote a 
> test program (concerned that my code was problematic) .. it turns out it 
> gives some weird results... like software renderers are faster than 
> hardware renderers, and that with accelerated SDL_FillRect and SDL_CopyRect 
> are about 120x faster on a native build than a web build....
>
> Old build uploaded for your excitement (instant results!)
> http://robprobin.com/SDL2_emscripten_tests/
>
> Test code:
> https://github.com/robzed/SDL2_emscripten_tests
>
> Some results here: 
> https://discourse.libsdl.org/t/emscripten-sdl2-performance/27236/
>
> Comments or thoughts welcome.
>
> Yeah, less sprites or rects would make it work better :-)
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/emscripten-discuss/94ccfb7a-bfad-4d75-801b-0eec9c4edc83%40googlegroups.com.

Reply via email to