948 points · by apaprocki · 7y ago · 261 comments
1. Are there anyone on HN knows him in real life?
2. Does anyone have other people in their mind who is in the same league as this man? Mike Pall's LuaJIT sort of make him at this level but that is only one thing. Fabrice create things that everyone are using it one way or another, and if it wasn't HEVC patents mess we would have his bpg [1] replacing jpeg.
Do you ask this to know if he's a real guy or an AI or a pseudo for group of persons like https://en.wikipedia.org/wiki/Nicolas_Bourbaki ?
I know Fabrice a little. He's definitely real, smart and humble.
Visited him at his workplace about ten years ago when he worked at Netgem.
We also have a common friend we visit with spouse and kids, where we discover and discuss new gadgets (physics-based, drones, mechanical puzzles, etc). One day we played with a kind of padlock where the lock procedure implied to move a sort-of 4-direction joystick. The trick was: you could do any number of moves to lock it. It seemed like it allowed to store an arbitrary long sequence of numbers in a finite mechanical system. Fabrice arrived, heard us explain, thought, and said "the mechanics probably implements some sort of hash algorithm". That was the answer.
He is definitely very humble and a very good listener. When he told us about this side project he was working on about a year ago, he made it seem like it wasn't a big deal, just a small js engine, would never compete with v8. After a few questions, it was clear that the goal was to implement the latest ECMAScript spec, with all the goodies. It will never be in the v8 league, but it's on a league of its own.
I referenced this document a lot when writing my own Telnet stack.
Definitely a legend!
I'm trying to put into words what the difference feels like. Git and linux demonstrate, for Linus, great intelligence but not genius, the way Ballard's works do. And on Linus' side, git and linux demonstrate leadership, pragmatism, and a tremendous understanding of how to actually drive a large project forward over time, which Ballard's works don't.
Pike's account of how UTF-8 was invented is a fun read: https://www.cl.cam.ac.uk/~mgk25/ucs/utf-8-history.txt
bellard.org - has the most impressive portfolio of software created from a single developer I've ever seen. It's more astonishing how varied each of his accomplishments are - covering some of the hardest programs in different computer science fields.
He's by far the best programmer in my book, I'm not sure who I'd put at #2, there's a number of contenders, but anyone else I can think of are experts in their respective fields, I don't know of anyone who has compiled such a broad list of complex software covering that many different fields.
I’d argue it is a whole lot more than most PhD thesis.
Fabrice is a wizard.
What makes this JS implementation deserve the name "Quick"?
I noticed it doesn't appear to do JIT compilation or any of the fancy optimisations V8 does. So whilst it may start up quickly, and may interpret quickly, it won't actually execute JS quickly relative to V8, unless I missed something huge in the linked web page.
I got the sense there are several performance claims here that sound impressive but won't actually matter for nearly every JavaScript user.
Just to learn that it is indeed the same guy (plus Charlie Gordon) :D
The second project of his that I came across was https://en.wikipedia.org/wiki/Bellard%27s_formula and his page on π: https://bellard.org/pi/
Despite my general distaste for JS largely due to websites tending to abuse it more than anything, this project is still immensely impressive and very inspiring, and one wonders whether there is still "space at the bottom" for even smaller but functionality competitive implementations.
Why would you have a distaste for JavaScript based on how others use it? JavaScript has evolved into an extremely powerful and flexible language which is taking many great lessons from other languages. Sure its not perfect but its a real workhorse.
EDIT: I know you're not meant to ask why the downvotes, but I do wonder in this case - the comment is a reasonable one, I guess it's the many JavaScript haters piling on - "Haters gonna hate". I stand by these comments - JavaScript is a flawed but great language that has only proven over time its flexibility and adaptability to become probably the single most used language - the people who don't like it are those who don't use it/understand it.
Languages don't exist in a vacuum. The way libraries are written and the way coworkers write code has a huge effect on us.
> proven over time its flexibility and adaptability to become probably the single most used language
Its usage has nothing to do with its quality. The web has a low barrier to entry, and well web devs have to use JS because browsers handcuff us to it.
If JS were so great, we wouldn't have increasing TypeScript adoption or a million compile-to-JS languages.
I've been writing JS for 20 years. I use bleeding-edge features, TypeScript, and Babel. I've done front and back end. It still sucks (which is sometimes the fault of V8, but not always).
I'm not a JavaScript hater - these days it's my main language - but your comment was pedantic and interpreted his words uncharitably. By "distaste for JS" he clearly just meant vague negative emotions surrounding it, not that he thinks it's an invalid language. He even specifically says his distaste is circumstantial.
I also notice people often conflate the problems of overzealous browser-based scripting with JavaScript the programming language. This is pretty understandable since JavaScript has been the only browser scripting option for 2 decades, but those problems would exist no matter what options were available for browser scripting. It's a safe bet to assume that the problems would actually be much worse if JavaScript wasn't the only browser scripting language available since that would mean browser-based scripting would be more accessible to more programmers.
In another 6-8 years when WASM targeting alternatives become more mature we will see a new explosion of browser scripting.
Having both programmed PHP and Javascript extensively, PHP when it was first designed was absolute junk, functions were bucketed by strlen. Javascript at least had some semblance of sanity even with the wonky comparison mess and ===.
I would love to find a language I consider more elegant than modern JS/TS. Haven't seen anything yet though. I also question your claim that it's the "elite" who regard JS with derision. Fabrice is presumably fine with it considering he spent valuable time writing an engine for it.
Observe that Bellard's own site, despite having a few JS-based projects and demos, and now himself being the author of a JS engine, has not succumbed to the "JS everything!!!1" fad.
(FYI I didn't downvote.)
I've never heard my parents or non-developer friends complain about a site using too much JavaScript, but if I show them Hacker News or old.reddit.com, they'll complain it looks ugly and hard to read/use and really do lose interest in it immediately.
Anyway, I fail to see how this is a problem of JavaScript. Replace JavaScript with any other language in the browser and you'll see exactly the same abuse happen.
If you really dislike JS so much, do what I do and disable JavaScript in the browser. If a site doesn't work I don't use it. People on Hacker News seem to want the web to revolve around themselves but it never has done and never will.
I like my languages a bit less flawed, thank you very much.
EDIT: tombert beat me to it[0] by a couple minutes.
this project seems to have started in 2017. from a quick glance at the code, they used c (his favorite language) -- which by the way people are still there convincing us not to use. many of us would have been discouraged, distracted, or simply fazed by the pace of our field.
that is so inspiring.
Here is an alleged UAF in this library https://twitter.com/qwertyoruiopz/status/1149424025111801858
What do you mean by that? The only way I see him dispelling that myth is that he's a 100x programmer instead of a 10x.
https://github.com/jerryscript-project/jerryscript
Granted, the targets aren't exactly the same (micro-controllers vs very small lib), but benchmark differences are impressive:
Also a lot of useless consultants would earn that much, as would people doing shady shit, as well as many talented people so the $ comparison is kind of insulting.
My co-worker Jason wrote a JS engine in Rust, Boa (https://github.com/jasonwilliams/boa) and demoed it via WASM in the browser at the recent JSConf.EU 2019: https://www.youtube.com/watch?v=_uD2pijcSi4
https://github.com/jterrace/js.js/
This shouldn't be surprising - many VMs have been compiled to the Web, like Lua, Python (both CPython and PyPy!), etc., and JS is just another VM.
Online demo of JSC.js
However, it's still 2-3x slower than the optimized, CPU-specific interpreters used in LuaJIT and V8 (with their JITs disabled), and 20-100x slower than the LuaJIT, V8 and PyPy JIT compilers.
I figured there's no way it would be as fast as say V8 who has Google+others working for years to make it as fast as possible.
Not that it's a bad thing! They just have different purposes.
-- QuickJS -- PROGRESS Richards RESULT Richards 445 PROGRESS DeltaBlue RESULT DeltaBlue 424 PROGRESS Encrypt PROGRESS Decrypt RESULT Crypto 633 PROGRESS RayTrace RESULT RayTrace 271 PROGRESS Earley PROGRESS Boyer RESULT EarleyBoyer 771 PROGRESS RegExp RESULT RegExp 180 PROGRESS Splay RESULT Splay 923 PROGRESS NavierStokes RESULT NavierStokes 1979 SCORE 549
-- v8 (node) -- PROGRESS Richards RESULT Richards 31083 PROGRESS DeltaBlue RESULT DeltaBlue 51056 PROGRESS Encrypt PROGRESS Decrypt RESULT Crypto 36692 PROGRESS RayTrace RESULT RayTrace 63343 PROGRESS Earley PROGRESS Boyer RESULT EarleyBoyer 50309 PROGRESS RegExp RESULT RegExp 7910 PROGRESS Splay RESULT Splay 22964 PROGRESS NavierStokes RESULT NavierStokes 35214 SCORE 32307
Main purpose of them is to be a glue between native calls: take output of one native function and pass it as input to other. So instead of writing ray-tracer in JS you should write it as a native function (not even in webasm).
In my Sciter (https://sciter.com) I had the similar dilemma:
Either to use a) some compileable language (of V8 with JIT) or to use b) something small but to provide easy ways to extend script by custom native functions.
I've chosen b) and so the engine that does HTML/CSS and scripting is 6 times more compact than just only V8 binaries. For an embeddable engine that is clearly better.
For browsers, where running JS and no real ways for native code execution... they MUST have V8 and the like. That also leads to Electron problems... browser engines are simply not suitable to be used as embeddable UI engines, by design.
For those who don't know, the author is one of the most prolific programmers/creators of our time. Please check his bio [1]
[1]: https://en.wikipedia.org/wiki/Fabrice_Bellard
[2]: https://bellard.org/quickjs/quickjs.html#qjsc-compiler-1
1420 th = js_mallocz(ctx, sizeof(*th));
1421 th->has_object = TRUE;
1422 if (!th) {
1423 JS_FreeValue(ctx, obj);
1424 return JS_EXCEPTION;
1425 }
But hey, that's gonna get ironed out. :)Even if the developer is a genius and the project isn't that big.
I suspect this is the result of th->has_object being added later than the surrounding code. I don't think someone would write this code on the first attempt with this bug. It's too obvious.
If the code repo ever becomes available, I'll check my theory out. :D
Also - Yay! Another awesome target for ClojureScript - capable of producing standalone binaries!
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.
Link on frontpage at this point in time: https://news.ycombinator.com/item?id=20412588
What would someone....do with this?
Use it to run JS on some embedded device where you can run C?
So there's definitely a need for more lightweight contenders in this space.
Ideally someone would just do an "stb"-style JavaScript interpreter that would fit into a single .c or .h file. This is closer to that ethos than most other candidates, and as others have noted, Fabrice's credibility as a '1337 h4x0r gives it an instant leg up on the competition. I don't have an urgent need to switch away from V8 right now, but I'll be watching this project with moderate interest.
DukTape is already that.
Does the the application basically pass data to a user script (the user knows JS so it is useful for them?), and then the JS returns the data after processed?
Amusingly I asked the question and remembered that I actually worked on (supported) a hardware product that did this to some extent. It was a disaster as the scripting language would eat memory / cpu and crash the box ;)
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).
"Please don't post shallow dismissals, especially of other people's work. A good critical comment teaches us something."
As an Emacs programmer, I much prefer working in one 10kloc file than 20 500loc files. The later I find pretty overwhelming.
Hopefully QuickJS won't discourage the author of Duktape from making future releases of his incredible small low-memory JS engine.
Such hardship. High quality software is provided for free and people are complaining about the distribution format? Code was developed just fine before github. If viewing files in a tarball is an impediment then this library is not for you.
Macos can decompress them natively without installation.
> No idea if mobile ever crossed their mind.
If it was released on github/gitlab/gitea/etc they wouldn't need to.
It's not a big deal but it does add an extra step.
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)
InternalError: out of memory in regexp execution at test_regexp (tests/test_builtin.js:427) at <eval> (tests/test_builtin.js:594)
Just had a vision of a hacker blog where the author starts out writing in the most godawful VB6 spaghetti, gets some sort of brain operation and subsequent blog postings are like Linux booting in RISC-V implemented in Conway's Game of Life. Then suddenly a mouse dies and the quality gradually reverts back to how cool the <BLINK> tag is in HTML.
https://bellard.org/projects.html
He's got over 40 projects in total there, and each one of those is deep --- they would either take a very long time or be impossible for the average programmer. In contrast, many other programmers I've heard claim to have done over a dozen different projects turn out to really be "I glued several libraries together" repeated many times; very much the opposite of Bellard.
In fact, I suspect one of the reasons he is so productive is because he shuns all social media.
I have a bunch of projects, drones, 3d printers, computer clusters, a bunch of programs I want to make - I have all the tools, I already own all the things I mentioned.
But I suffer from depression/other stuff, and I haven't touched them in months. Let alone this guy, who is presumably pounding away at his keyboard for hours everyday.
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 keyword: import
at examples/hello_module.js:3
I don't know what I did wrong – anyone else try it yet?[1] https://bellard.org/quickjs/quickjs.html#qjs-interpreter
Really cool stuff!
Imposter syndrome kicks in when I see how much Fabrice has accomplished.
What a legend.
std.printf("%d\n", 1);
std.printf("%s\n", os.platform);
However it does not compile to a binary and doing something like: import std from "std";
import os from "os";
std.printf("%d\n", 1);
std.printf("%s\n", os.platform);
compiles via `./qjsc -m -o default_modules examples/default_modules.js` however does not execute: $ ./default_modules
SyntaxError: export 'default' in module 'std' is ambiguous
Source: https://github.com/smalldatatech/quickjs/blob/master/example... import * as std from "std";
import * as os from "os";
std.printf("%d\n", 1);
std.printf("%s\n", os.platform)If you want a very fast javascript engine and dont have problems with binary size, memory constraints and executable memory pages, you can pick a JIT like V8, Chakra or Spidermonkey. As those JITs are pretty advanced optimizing JIT compilers and will run javascript code very fast, much faster than the fastest interpreted VM implementation can.
People who tend to choose this instead of V8 for instance need to run this in a microcontroler for instance, or a OS without executable memory pages (and therefore where JIT´s are forbidden).
Results for a 30x30 symmetric matrix processed using exact same code for both engines:
NodeJS: ~20 seconds QuickJS: ~200 seconds
So, from a single experiment QuickJS seems about 10x slower than NodeJS for this particular use case.
If you have any questions or suggestions, write to fabrice at bellard
This is peak JavaScript. How deep can we go?
Looks like QuickJS doesn't use setjmp/longjmp, as opposed to duktape. I really like this, as it will simplify memory management inside C functions, and allow to use gcc cleanup functions.
I can't be happier that it doesn't use setjmp/longjmp to handle exceptions. It makes memory management easier.
Everything is very straightforward. You can even get ref leaks report if you use -DDUMP_LEAKS.
Undefined symbols for architecture i386
I get this error when attempting to make on macOS.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?
Hacky workaround: comment out the "CONFIG_M32=y" line in the makefile. This will disable building the 32-bit versions of some tools. ("Edit the makefile" is, according to the docs, the canonical way to customize your build settings.)
And I don't think there's any real shortcut for dealing with compiler error messages. You've just got to learn what they mean and what sort of thing tends to cause them.