Light WASM Baseline
This is a quick post to test light-wasm integration.
With this simple implentation, I want to compare the wasm implementation against the JavaScript code performance. I also want this to act as a baseline with future iterations of the Light project.
One thing you will notice is that the lighing doesn't look exactly the same as the JavaScript path tracer, the reason for this is that Light uses a different algorithm to generate a random ray from an intersection point. This algorithm is biased to generate rays with an angle of incidence with higher potential for illumination.
Summary
Some performance numbers
The following numbers were taken using Safari 18.0, in a M1 MBA running macOS Sequoia (15.0) on Low Power Mode:
Implementation | Time Per Frame |
---|---|
JavaScript | 1230ms |
Light Wasm | 202ms |
Light, as you can see, is significantly faster than the JavaScript path tracer. Much of this is thanks to the Rust language, the LLVM compiler, and the low amount of data moved between Wasm and JavaScript. Another point is that I didn't enable SIMD support during compilation, and looking at the WAT decompilation there are no traces of vectorization, this means that there is more room to improvement.
Now to figure out what the next step is going to be.
Enrique CR - 2024-09-24