Wrong Technology

Nitro in Web Assembly - Performance

Here's some rough insight into what happens when you run a Nitro app entirely in-browser.

Without Wasm

Nitro requires 717kB of dependencies in the browser, regardless of whether you're using Wasm or not (717kB gzip / 3.3MB raw):

File Size
styles.css 7.5kB
main.css 1.5KB
main.js 3.2MB
loading.gif 18.1kB
[font].woff2 33.5kB
[font].css 1.3kB
favicon.ico 15.4kB
Total 3.3MB

Once the above dependencies are loaded, application startup is near-instantaneous.

Adding Wasm

The same app on Wasm requires an additional 8.15MB (8.15MB gzip / 18.19MB raw):

File Size (gzip / raw)
nitride.js 1.8kB / 5.4kB
h2o_nitro-[...].whl 12.8kB / 12.8kB
pyodide.js 14.8kB / 46.0kB
packages.json 5.5kB / 28.0kB
pyodide_py.tar 103kB / 103kB
pyodide.asm.js 322kB / 2MB
pyodide.asm.data 3.4MB / 5.4MB
pyodide.asm.wasm 3.2MB / 9.5MB
distutils.tar 984kB / 984kB
micropip-[...].whl 16.8kB / 16.8kB
pyparsing-[...].whl 98.8kB / 98.8kB
packaging-[...].whl 41.4kB / 41.4kB
Total 8.15MB / 18.19MB

Of these, Nitro's dependencies are negligible (~14kB).

Downloading and initializing the above dependencies adds 3-5 seconds of overhead. YMMV depending on network, CPU and browser.

Overall, not bad, but the overhead is noticeable.

That said, notice that Nitro runs unmodified in browsers. The same ~13kB h2o-nitro wheel from PyPI runs as is, with an additional 1.8kB for nitride.js, the application runtime atop Pyodide.

« Nitro v0.11 shipped with Web Assembly support Nitro v0.12 - live change handling »