Would it be possible to compile a nodejs app to a binary with this? If so, would performance be any better?
I think you'd need to translate node specific APIs in order to make this work, e.g. i/o features and require function. It is probably more work than just rewriting the app to use QuickJS APIs instead, but I don't think it's impossible to make some sort of compatibility or translation layer. Couldn't say if it'd be more performant, but it'd have a killer feature over node: compilation to single binary without dependen…
QuickJS JavaScript Engine
21–30 of 279 posts
Re: QuickJS JavaScript Engine
#22I'm curious as to how the reference counting works in this. Is it comparable to what's used in Swift? How is it compared to the methods typically used in V8 and Spider Monkey?
They do bookkeeping on every free whereas a heap scanning gc will typically do bookkeeping in small incremental bits on alloc and mainly on gc cycle (when space runs low).
Re: QuickJS JavaScript Engine
#23I just tried building this on my Mac and it looked initially like it all was building fine, but it eventually failed when building qjs32. Thinking this probably didn't matter much I went ahead and ran `./qjs examples/hello.js` which worked as advertised – cool! Tried `./qjsbn examples/pi.js 5` and it worked as well – very cool! Then I tried `./qjs examples/hello_module.js` and got this: SyntaxError: unsupported keywo…
[1] https://bellard.org/quickjs/quickjs.html#qjs-interpreter
Re: QuickJS JavaScript Engine
#24I just tried building this on my Mac and it looked initially like it all was building fine, but it eventually failed when building qjs32. Thinking this probably didn't matter much I went ahead and ran `./qjs examples/hello.js` which worked as advertised – cool! Tried `./qjsbn examples/pi.js 5` and it worked as well – very cool! Then I tried `./qjs examples/hello_module.js` and got this: SyntaxError: unsupported keywo…
Re: QuickJS JavaScript Engine
#25Re: QuickJS JavaScript Engine
#26EDIT: tombert beat me to it[0] by a couple minutes.
Re: QuickJS JavaScript Engine
#27quickjs.c is a 47,842 line C file. I think that sets the record for the largest handwritten file I've seen.
Is it hand-written as a single file, though? I'm assuming the release is the output of some script that does concatenation.
Re: QuickJS JavaScript Engine
#28I tend to stick with the ECMAScript core whenever I can and avoid using packages from NPM, especially ones with binary components. A lot of the time that slows me down a bit because I'm rewriting parts of libraries, but here everything should just work with a little bit of translation for the OS interaction layer which is very exciting.
Re: QuickJS JavaScript Engine
#29Is there anything that Fabrice can't do? I mean, FFMpeg is almost a PhD thesis in and of itself, and he still manages to find time to make TinyC, QEMU, and now this. To say I'm jealous of his skills would be an understatement.
Re: QuickJS JavaScript Engine
#30Earlier quoted context omitted.
I think you'd need to translate node specific APIs in order to make this work, e.g. i/o features and require function. It is probably more work than just rewriting the app to use QuickJS APIs instead, but I don't think it's impossible to make some sort of compatibility or translation layer. Couldn't say if it'd be more performant, but it'd have a killer feature over node: compilation to single binary without dependen…
Couldn't you replace v8 with this and recompile the node binary? If it passes 100% ECMAScript tests, that should mean it's a drop-in replacement for v8. Correct me if I'm wrong.