3 ms·
As I understand it: > Do people really want to use such complex, heavyweight languages for scripting? The way I'm reading this, "scripting" should be taken to
by geofft 6y ago
As I understand it:
> Do people really want to use such complex, heavyweight languages for scripting?
The way I'm reading this, "scripting" should be taken to mean "embedding." Sometimes you do want to run significant amounts of code in a context where traditionally you'd want an embeddable language like Lua or JavaScript, but the fact that such languages are built for scripting (i.e., more optimized for connecting other high-performance components together in a flexible way than for being a high-performance component itself) becomes a limitation.
Some historical examples of where people have wanted complex languages in embedding contexts where scripting languages would have been an easy choice: Google Web Toolkit (write webapps in Java compiled to JS), ActiveX, eBPF, the very idea of loadable native-code modules itself. All of those approaches to the problem have their downsides.
> Do garbage collection pauses cause significant issues when embedding Lua or JavaScript?
Yes, https://www.google.com/search?q=javascript+gc+pause https://www.google.com/search?q=javascript+gc+pause
> If so, I would expect implementations of those languages to switch to reference counting
Reference counting and tracing garbage collection are duals of each other (Bacon et al. 2004, "A Unified Theory of Garbage Collection," which is a great read). You're going to do the same amount of work in both cases if you manage to clean up the same garbage (i.e., if you deal with cycles), it's just a matter of when/how you do it. Technically, yes, reference counting gets you predictable performance (unless you solve the cycle problem with a backup tracing GC), but it may not have the characteristics you want. Knowing in advance that you're going to decref a bunch at an inconvenient time doesn't really help the underlying problem of GC pauses. :)
> To get good performance, don't WebAssembly implementations need to use JIT-compilation internally?
I think only if you are running wasm that changes dynamically / independently of the application, which on at least one "for reasons" platform (iOS) you can't do anyway. If you're willing to ship the wasm with your application, you can AOT-compile it.