evo-lua / evo-runtime

All-in one Lua runtime based on LuaJIT and libuv
https://evo-lua.github.io
Mozilla Public License 2.0
10 stars 1 forks source link

Consider splitting the runtime into a regular and a downsized version (for servers/headless apps) #280

Open Duckwhale opened 10 months ago

Duckwhale commented 10 months ago

Many programs won't need the full power of WebGPU, GLFW, and other "GUI-like" libraries. Also reduces binary size/build time.

Not sure if I really want to do this, as I didn't like the split that evo-luvi had (and quickly removed it). But now, there are many more libraries and many of them are somewhat specialized. It's nice getting to use them out-of-the-box, but obviously this isn't free.


How: Instead of a single "chunky" binary, there'd be two versions:

As for libraries, anything required for graphics, windowing, etc. can be moved out of the headless version. Networking/utilities stay.

TBD: Does it make sense to link with OpenSSL dynamically in the headless version? (Probably, yes)

Roadmap:

Duckwhale commented 10 months ago

WIP: Gathering some data before making any final decision...


Libraries that are "useless" in server/CLI applications:

Libraries that disproportionally increase CI build times:

Libraries that disproportionally increase binary size:

TBD: Cold startup time (probably proportionate to binary size); may be impacted slightly by DLL/SO load? (measurable?)

TBD: How much can be gained (with regard to these metrics)? Guess: Removing the "biggest" 3-5 would be worth it.

Duckwhale commented 9 months ago

Should also consider cost/benefit for these primary supported use cases:

Some dependencies are basically free, while some (OpenSSL) are workhorses that come with a heavy cost.

One other, semi-related question is which of the embedded dependencies could be moved to external packages. Realistically, anything that requires C/FFI glue would have to have at least some runtime components that ship by default. The Lua FFI side is pretty lightweight and can be loaded on demand, so there's no reason to omit that. And the static libs can be provided as DLL/SO.