5 ms·
What JavaScript interpreter do you use for embedding? I know of MuJS [1] but it only supports ES5. [1] https://mujs.com/ https://mujs.com/
by vmsp 8y ago
What JavaScript interpreter do you use for embedding? I know of MuJS [1] but it only supports ES5.
[1] https://mujs.com/ https://mujs.com/
- sdegutis 8y agoMy JS-embedded apps only target macOS so I use Apple's builtin JavaScriptCore framework.
- nikki93 8y agoIn my experience LuaJIT in interpreter only mode has better performance than using JSC (you can’t use JIT in JSC either — only WKWebViews can JIT). (edit: sorry this is regarding iOS)
- sdegutis 8y agoMaybe, but my use-cases (window manager and other automation stuff) don't really have a strong need for speed or high performance. Mostly it just sits there idle 99% of the time and runs callbacks quicker than the UI that it manipulates is visibly updated.
- nikki93 8y agoYeah I think it does end up boiling down a lot to use cases because the big differences b/w Lua and JS are in availability of libs / integration and perf. In my case I do a lot of 2d graphics where love2d.org is available and perf is important. :) C interop is also really important, and LuaJIT C FFI is waaaaay nicer to use than JSC C API. I’ve ended up doing a lot of JS with React Native for “app-y” mobile apps though.
- sdegutis 8y agoIf perf is important, I'm surprised you're using Love2d and not just using C++ with SDL and Box2d directly. Afaik Love2d just uses vanilla Lua (and not LuaJIT) which, while faster than similar languages, is still pretty wasteful of cycles when high perf is needed.
- dividuum 8y agoThere's duktape (https://duktape.org/ https://duktape.org/), which, from skipping over the documentation seems very similar to Lua when it comes to embedding: It also uses the stack based approach. Looks like there's some ES6/7 support.