CindyJS icon indicating copy to clipboard operation
CindyJS copied to clipboard

ER: compile CindyScript to WebAssembly

Open kortenkamp opened this issue 7 years ago • 2 comments

It would be nice to see a compilation to WebAssembly (instead of JavaScript) of CindyScript. Just an idea.

kortenkamp avatar Nov 29 '18 16:11 kortenkamp

This would be great, perhaps we could switch some basic operations to webassembly code. Some time ago I played around with typed arrays for CSNumber, but it turned out to be slower than expected (https://github.com/CindyJS/CindyJS/compare/master...strobelm:typed_complex)

On 11/29/18 5:02 PM, kortenkamp wrote:

It would be nice to see a compilation to WebAssembly (instead of JavaScript) of CindyScript. Just an idea.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/CindyJS/CindyJS/issues/712, or mute the thread https://github.com/notifications/unsubscribe-auth/ANhz4lg4O5jpEJXVTpcsd9fZvD12Sh2Xks5u0AUkgaJpZM4Y5_C8.

strobelm avatar Nov 30 '18 10:11 strobelm

It would be great to speed up CindyJS for some further cases. But implementing such systems might demand more resources than we have.

I doubt that changing some basic operations into WASM would do the speedup because often the intermediate data structures for values could be the actual bottleneck. For basic operations, maybe convexhull could be a candidate.

I think a real transcompilation for entire code-fragments such as a = apply(1..N, k, f(k)); could change something significantly. However, as it is the case for CindyGL, the types have to be detected for WASM and transpilation rules for a lot of elementary operations would have to be written in WASM. If the transcompilation fails for some (sub)-fragments, these could be evaluated via javascript.

If we want to investigate these approach further, I suggest collecting some examples which tend to run too slow and think about which changes would have to be done to speed them up.

montaga avatar Dec 03 '18 11:12 montaga