slint-ui / slint

Slint is a declarative GUI toolkit to build native user interfaces for Rust, C++, or JavaScript apps.
https://slint.dev
Other
17.55k stars 601 forks source link

Feature request:AOT compile Javascript and UI code to native code #3931

Closed ansarizafar closed 9 months ago

ansarizafar commented 12 months ago

Slint UI framework is absolutely amazing. Slint Javascript SDK is currently using an interpreter to transform UI code at runtime which is not good performance and native binary size. It would be great If both Javascript and Slint UI code can be compiled to native code. Here is the relevant disscussions on this topic. https://chat.slint.dev/public/pl/1ygwzcot83nodxbqbcmba8mfac

tronical commented 12 months ago

In my experience JavaScript compiled to native code ahead of time is bigger and slower than a good byte code representing and a tracing JIT (like node's v8). That's because types are only reliably known at runtime, so AOT generated code needs to be generic, which makes it larger and slower.

In Slint, we are not going to implement an AOT JS to native compiler - that's not in scope.

Is there a specific benchmark we should target or AOT engine that Slint should support?

ansarizafar commented 12 months ago

There was a Javascript compiler project https://nectar.js.org/ but I think the project is not maintained anymore.

tronical commented 9 months ago

We don't plan to implement this at the moment.