Zig Compiler works great for compiling C Libraries into WebAssembly. Can we preview an LVGL App in the Web Browser… With WebAssembly and Zig Compiler?
Let’s find out! In this article we’ll…
Run a Zig LVGL App on PinePhone (with Apache NuttX RTOS)
Explain how Zig works with WebAssembly (and C Libraries)
Compile LVGL Library from C to WebAssembly (with Zig Compiler)
Test it with our LVGL App (in Zig)
Render Simple LVGL UIs (in Web Browser)
Later we might render LVGL UI Controls (with Touch Input)
Check out the article…
(Possibly) LVGL in WebAssembly with Zig Compiler
Do you know how the performance of Zig compares to C?
Thanks Gabor! If we’re talking about Zig Compiler compiling LVGL Library from C to WebAssembly: The performance is probably the same as Clang Compiler, since Zig Compiler calls Clang.
If we’re comparing Zig Code with C Code: Zig has slightly extra overheads because of Runtime Safety Checks. But the checks can be turned off:
I meant the “normal” Zig and C to binary case. Thank you for te link.
Anyway, if we keep the rendering in C, a Zig binding shouldn’t be too slow.