Is 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.
Wow. The core is a single 1.5MB file that's very readable, it supports nearly all of the latest standard, and Bellard even added his own extensions on top of that. It has compile-time options for either a NaN-boxing or traditional tagged union object representation, so he didn't just go for a single minimal implementation (unlike e.g. OTCC) but even had the time and energy to explore a bit. I like the fact that it's not C99 but appears to be basic C89, meaning very high portability.<p>Despite my general distaste for JS largely due to websites tending to abuse it more than anything, this project is still <i>immensely</i> impressive and very inspiring, and one wonders whether there is still "space at the bottom" for even smaller but functionality competitive implementations.
This man is a wizard. You can also thank him for ffmpeg and qemu. A company I worked for once tried to hire him as a consultant because he had implemented an LTE BTS in software. Is there anything he <i>hasn't</i> done?<p>EDIT: tombert beat me to it[0] by a couple minutes.<p>[0] <a href="https://news.ycombinator.com/item?id=20413498" rel="nofollow">https://news.ycombinator.com/item?id=20413498</a>
Worth noting: the demo is a WASM-compiled instance of this engine. I'm not sure, but I think this might be the first example of a fully featured, potentially production-ready, JS VM sandbox running in the browser. (We're looking into safe ways to enable third party scripting of our own application, and such a sandbox would be a <i>very</i> nice tool to have in hand.)
The benchmark scores [1] he gives only stack it up against other embeddable engines. It cuts those to ribbons, but can someone who's familiar with JavaScript performance weigh in on how it competes with the most popular engines like V8 and SpiderMonkey? It would be interesting if this is so fast that you could re-implement Node using QuickJS instead of V8, or even make a WebKit- or Gecko-based browser with QuickJS under the hood. Presumably a lot of the headaches with swapping in a new JS engine have to do with dependencies, and this has none.<p>[1] <a href="https://bellard.org/quickjs/bench.html" rel="nofollow">https://bellard.org/quickjs/bench.html</a>
From the documentation [2], compilation of js to c looks very interesting. If variable types are well known/defined (like Uint8Array, ..), this effectively presents a way to derive performant binaries from js<p>For those who don't know, the author is one of the most prolific programmers/creators of our time. Please check his bio [1]<p>[1]:
<a href="https://en.wikipedia.org/wiki/Fabrice_Bellard" rel="nofollow">https://en.wikipedia.org/wiki/Fabrice_Bellard</a><p>[2]: <a href="https://bellard.org/quickjs/quickjs.html#qjsc-compiler-1" rel="nofollow">https://bellard.org/quickjs/quickjs.html#qjsc-compiler-1</a>
qwertyoruiopz already found a use-after-free bug: <a href="https://twitter.com/qwertyoruiopz/status/1149424025111801858" rel="nofollow">https://twitter.com/qwertyoruiopz/status/1149424025111801858</a>
I can't wait to mess around with this, it look super cool. I love the minimalist approach, if it's truly spec compliant I'll be using this to compile down a bunch of CLI scripts I've written that currently use node.<p>I 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.
... and facebook releases Hermes JS Engine the same day. Coincidence, or conspiracy?<p>Link on frontpage at this point in time: <a href="https://news.ycombinator.com/item?id=20412588" rel="nofollow">https://news.ycombinator.com/item?id=20412588</a>
I have a potentially dumb question as I'm way out of my element here.<p>What would someone....do with this?<p>Use it to run JS on some embedded device where you can run C?
I'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?
I like that Bellard released the source code in old school tar format rather than on github. The world's code collaboration platform is of little use to the world's best programmer.<p>Hopefully QuickJS won't discourage the author of Duktape from making future releases of his incredible small low-memory JS engine.
Can not pass tests from armv8l, the site seems no bug report links. is anyone know how to let bellard know this ?<p>make -j8 test
./qjs tests/test_closure.js
./qjs tests/test_op.js
./qjs tests/test_builtin.js
Error: assertion failed: got |2e+1|, expected |3e+1|
at assert (tests/test_builtin.js:17)
at test_number (tests/test_builtin.js:307)
at <eval> (tests/test_builtin.js:589)
I just tried building this on my Mac and it looked initially like it all was building fine, but it eventually failed when building qjs32.<p>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:<p><pre><code> SyntaxError: unsupported keyword: import
at examples/hello_module.js:3
</code></pre>
I don't know what I did wrong – anyone else try it yet?
I was like "oh no, not another JS engine", and then I've seen it's on bellard.org... and I thought to myself, ok, this is the future!
I'm asking this here because I don't really know where else to do so: I'm trying to compile a binary from a js source that uses the standard modules (they are loaded by default if you run the interpreter) so the following works:<p><pre><code> std.printf("%d\n", 1);
std.printf("%s\n", os.platform);
</code></pre>
However it does not compile to a binary and doing something like:<p><pre><code> import std from "std";
import os from "os";
std.printf("%d\n", 1);
std.printf("%s\n", os.platform);
</code></pre>
compiles via `./qjsc -m -o default_modules examples/default_modules.js` however does not execute:<p><pre><code> $ ./default_modules
SyntaxError: export 'default' in module 'std' is ambiguous
</code></pre>
Source: <a href="https://github.com/smalldatatech/quickjs/blob/master/examples/default_modules.js" rel="nofollow">https://github.com/smalldatatech/quickjs/blob/master/example...</a>
> An online demonstration of the QuickJS engine with its mathematical extensions is available at numcalc.com. It was compiled from C to WASM/asm.js with Emscripten.<p>This is peak JavaScript. How deep can we go?
Does Fabrice Bellard knows any other language other than 'c' ?. Looks all his works are in 'c'. Just trying to look if there is a correlation among the 100x programmers and the number of languages they know. Because being extremely proficient in a language is important to be highly productive.
<p><pre><code> Undefined symbols for architecture i386
</code></pre>
I get this error when attempting to make on macOS.<p>I don't have very much experience with C, but is there a good resource to learn how to better deal with compiler issues and such other than googling specific issues?
Does anyone know is this is x86 specific? It sounds like it’s just C but I’m not at a computer right now so I can’t dig in. It seems really interesting for embedded or mobile (iOS/Android) too
The operator overloading is potentially huge. Along with the BigInt/Float extensions, it makes it a great target for scientific computing applications.
How long before the nodejs and npm crowd runs all their JavaScript in this, compiled to wasm, on a real browser... For no real benefit, but a whole load of slowdown...