7 ms·
Layer 1 - assembly to get the system to boot and communicate with hardware. Layer 2 - C to schedule tasks, manage memory, provide filesystem support. Layer 3
by jrogers65 14y ago
Layer 1 - assembly to get the system to boot and communicate with hardware.
Layer 2 - C to schedule tasks, manage memory, provide filesystem support.
Layer 3 - C/C++ to provide a graphical user interface framework.
Layer 4 - C/C++ to render web pages.
Layer 6 - C/C++ to implement a Javascript VM.
Layer 7 - Javascript to implement a Lua interpreter.
Layer 8 - Game engine written in Lua.
Layer 9 - Game specific code written in Lua.
I wonder how much bang per Mhz this setup provides.
- azakai 14y agoThese layers aren't literal, though. For example, the JS VM can generate native machine code that can run just as fast as the assembly in layer 1. It's literally in the same language. (It won't be as fast always, of course, but in some cases it will.) Also, there is no reason Lua in JS could not run at similar speed to JS, if the translation from Lua to JS is efficient enough. Whether that is possible depends on how close Lua and JS semantics are. That could also be at least partially achieved by using a Lua VM that has a JIT, and implementing a JIT backend that emits JS. Such an approach could be quite fast.
- otibom 14y agoThere's always emscriptem https://github.com/kripken/emscripten https://github.com/kripken/emscripten
- jws 14y agoI'm down the same road. For me the amount of time in Lua is negligible. Rendering is the long pole which is mostly off in the graphics card.