QuickJS JavaScript Engine
bellard.org
bellard.org
I also thought the deterministic GC would mean lower memory usage but it's actually worse than V8 (which has all the intermediate bytecode, and the JIT-ed machine code as well in memory, plus the dangling objects).
Still impressed that someone could write an EcmaScript-compliant engine from scratch, but looks more like a proof of concept (the fact it didn't get any updates in a year doesn't help either).
1. Sciter.JS, with QuickJS, mainstream version now.
2. And former Sciter.TIS - uses my own TIScript. TIScript uses moving/compacting GC (close to V8).
We have several products ported [2] from TIS to JS already. I am not registering increased memory consumption but quite contrary sometimes.
In some cases deterministic reference counting schema is beneficial in UI, like:
function Foo() {
var nobj = new NativeObject();
nobj.dosomething();
}
// QuickJS will destroy nobj at exit from the function
[1] https://sciter.com
[2] https://terrainformatica.com/2022/02/19/freeconferencecall-a...Tried it a while ago, pretty decent.
I found an opposite sort of performance profile (few small values on the stack, shallow stack size) with lots of calls back and forth between C and JS worked really well. Or, a lot of situations outdid V8 and ChakraCore for me (with JIT disabled). I didn’t dig into the exact reasons why though.
Data sizes almost always exceed the size of the code itself. I wouldn't consider it surprising that the IR would fade away into the noise.
V8 can also make tradeoffs that QuickJS probably cannot. For example, v8 internally represents strings as 1-byte latin-1 characters rather than 2-byte UCS-2. This halves memory consumption, but adds a lot of code to the implementation that a microcontroller running QuickJS may not have room for.
In this case it is not that surprising as the same single person (Fabrice Bellard) also built ffmpeg, qemu, and tiny-c compiler.
AFAIK the JS code is not converted to C, but the compiler produces bytecode which is bundled with C code.
This is interesting because it means it's possible to execute JS code from languages that have C interop. So for example you can do SSR rendering of Svelte components in a Go server application. At least in theory, I've never tried this.
QJS is a lot smaller than V8. Granted, it doesn't have JIT, but for certain stuff it's ok.
$ echo 'console.log("hello world\n");' >hello.js
$ zip o//third_party/quickjs/qjs.com hello.js
adding: hello.js (stored 0%)
$ o//third_party/quickjs/qjs.com /zip/hello.js
hello world
Just add your source code to the qjs.com executable using InfoZIP and you've got a single file releasable binary that'll run on seven operating systems. It's also about 700kb in size. git clone https://github.com/jart/cosmopolitan
cd cosmopolitan
make -j8 o//third_party/quickjs/qjs.com
Build it on Linux but it runs anywhere. https://github.com/jart/cosmopolitan/tree/master/third_party... Here's a prebuilt binary https://justine.lol/qjs.comhttps://github.com/justjake/quickjs-emscripten#quickjs-emscr...
I believe Figma uses QuickJS for their plugin system.
Not sure how they exactly compare - seems QuickJS supports a newer JS standard?
Over the past few years I slowly built a small JS runtime using QuickJS as the engine and libuv as the platform layer, amongst other things, in case anyone wants to take a look: https://github.com/saghul/txiki.js
1) adjective . strange or unusual, especially so as to cause interest or amusement.
By requiring a .patch file to be sent via a mailing list, the sort of "burden of effort" shifts away from "log into Github and click the pencil icon in the preview for README.md" and towards a slightly-heavier-weight minimum threshold -- one that shouldn't be so bad as to discourage folks making earnest valuable changes, but might be enough to make low-effort spam more annoying for the spammer than the spam-ee.
†Yes, most people use webmail, not native desktop email clients, and no, it is not reasonable to expect people to switch for this.
(I've seen terminal jockeys do things that blew my mind, emitting continuous streams of characters that seamlessly switched between terminals and functions, orchestrating their machine like some virtuoso pianist, moving so fast it was impossible to follow. GUIs offer such folk nothing and I wouldn't be surprised if Fabrice Bellard was of this ilk.)
And I'm continually astounded whenever I bring up any GitHub criticism and get in response folks so hurried to try and "but Hillary!" me while leaping to the conclusion that I like mailing lists—even here in this case where I deliberately took special effort to start off by outright saying they suck. Let me be emphatic (again): mailing lists _really_ suck.
> This workflow inefficiency is multiplied by the number of patches you have
On the topic of things that suck: Git's CLI. Having said that, I'm not going to lie about it being worse than it is. You've moved your thumb off the scale. You're now saying things that aren't true.
Git's native workflows should be better. So should GitHub's.
> There is no good reason for it other than nostalgia for the old days of Unix
Go nerd-strawman someone else. I'm not Drew DeVault. I'm not the easily-take-downable bogeyman that, for your own convenience, you wish you were engaging with. I'm saying GitHub sucks because it does.
(As further data points: it's been only since, like, sometime after COVID lockdowns began that GitHub's site was finally fixed so that when you visit on mobile now, you don't get a horizontal scrollbar anymore. And this is the pre-eminent, tech-oriented platform that people can't stand to see being heralded as anything other than the thing that makes doing technical work feel like normal and approachable for normal people? Their "wikis" aren't even wikis, for fuck's sake.)
1. https://web.archive.org/web/20090202140249/http://www.bengoo...
I think if the world ends, it won't be due to Fire or Ice. I think the name of doom is "Convenience".
I thought it would happen much faster. Programming isn't that much harder than Go (the game not the lang) is it? Once automated programming becomes common and useful the problem domain shifts to mapping human intention(s) to the automated machinery, or how to write tame AI that can re-write itself w/o going feral? (Personally, I don't think it's possible, and Isaac Asimov pointed out why. It's the same "strange loop" explored in a handful of sci-fi stories that have hyper-lucky characters. What, ultimately, is good?)
In re: Free software vs. charging for copies of software, I looked at the world situation when I was younger and figured that no company or even nation could pay me what I'm worth (in terms of the value that my ability with computers could potentially unlock) and the most efficient way to "work" would be to give away my output and take advantage of the "rising tide that lifts all boats". I took Bucky Fuller very seriously, and still do: we have all the technology to make a secular utopia, it's just a matter of logistics and psychology. And the computers can handle the logistics easily. I figured the psychology would handle itself once word got around, but it hasn't really. (I don't know if I was just incredibly naive or if humans are just incredibly stupid, it's a problem that still vexes me.)
But I'm not being quite so literal. Imagine, say, all the value saved/created by the BitTorrent protocol, there's no way (that I can think of) for Bram Cohen to garner even a vanishing fraction of that value.
Ah, sorry, I should have been more clear above. When I speak of the value that BitTorrent created I don't mean piracy, I mean all the saved bandwidth and resources from having a more efficient protocol for transferring large files (for legitimate uses.) Maybe it was a bad example, instead think of John Cristy and ImageMagick, or Linus and Linux, the idea is that one contribution by one talented and skilled programmer can have huge, open-ended value, but that it's very hard to actually get paid even a minuscule fraction of that value.
To me, back in the day, in my fiery youth, it seemed much easier to reprogram economics itself by developing and releasing technology (Bucky's "Design Science Revolution") than to try to go the Jobs/Gates route and cash in. A quarter of a century or so later, it seems to me that the Free Software movement has pretty much failed, and I should have paid more attention when Etsy was handing out stock options...
> Please do not interpret this as me saying economies are a good thing.
It beats banging rocks together, but yeah. I'm in the "It was a bad idea to come down out of the trees." camp most days.
> The system is biased and new technologies put power into the hands of smart individuals springing up around the world.
We do live in interesting times, eh? I should take this opportunity to tell you that it's great fun watching you become a legend in your own time. Cheers! and well met.
> I should take this opportunity to tell you that it's great fun watching you become a legend in your own time. Cheers! and well met.
Thanks!
As I have mentioned elsewhere, activity is not a proxy for quality, but many other factors are, including the author, whose name I included in the submission but for some reason has been removed.
So, there -- we've both got complaints!
...
QuickJS is around 600kb. v8 is around 28,000kb.
You couldn't even fit v8 in a lot of the places where QuickJS is designed to run.