Hi,
I started a new experimentation (that I may not continue immediately), trying to see if a WASM implementation would be interesting.
Indeed, Brython is quite slow on big Python file (~1sec), and while SBrython is much faster (while doing less), performances aren't that great.
The idea of using WASM would enable :
- to have better control over allocations ;
- to have more choice in the structure I can use ;
- to specify the type of variables, enabling consistant and immediate optimizations.
I will look at 3 things :
- execution time ;
- startup time ;
- library file size.
I started with a trivial example, which weren't easy to properly configure xD.
The generated WASM file is 4kB (343 bytes once compressed), and load time is <0.5ms.
The question is thus whereas this will remain constant or grow on larger code base.
I copy/pasted ~100 times a function, the generated WASM is still 4kB (is this some kind of minimal size ?), load time is then ~2ms.
Currently, my SBrython code is ~484kB (strange, I though it was way less).
I generated 11500 C++ function to produce a code source of ~484kB in order to have a raw comparison.
The generated WASM file is 296K (I though it would be larger), 54k once compressed (similar to SBrython).
Load time is 51ms (vs 10-30ms for SBrython).
This seems quite bad for WASM, but the test isn't quite fair.
Therefore, I generated a JS test file with 11500 functions, and now the JS load time is ~3x slower than WASM.
It seems that WASM should be better.
I think I may try WASM on another (smaller) project before trying it in SBrython.