
QuickJS JavaScript Engine - apaprocki
https://bellard.org/quickjs/
======
tombert
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.

~~~
ksec
I have two question in my mind.

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.

[1] [https://bellard.org/bpg/](https://bellard.org/bpg/)

~~~
frutiger
Dan Bernstein. Researched curve 25519 and provided reference implementations
of x25519 & ed25519. Invented chacha20, such that it never branches on user
secrets to minimize side channel leakage. Along with poly1305, these form the
foundation of almost all “modern crypto” from Signal to TLS v1.3. He wrote
qmail as a superior MTA to the incumbent Sendmail. He’s even beat the US
government in court.

~~~
Twisol
And unless there's another software engineer named Daniel J. Bernstein out
there, he also authored RFC 1143 documenting the Q Method of TELNET Option
Negotiation [1], which prevents negotiation loops and nails down (in the shape
of a state machine) exactly what behavior is good and proper for a Telnet
peer.

I referenced this document _a lot_ when writing my own Telnet stack.

[1]
[https://datatracker.ietf.org/doc/rfc1143/](https://datatracker.ietf.org/doc/rfc1143/)

~~~
tambourine_man
>…when writing my own Telnet stack.

There’s probably an interesting story hidden in there.

~~~
Twisol
That probably depends more on the listener than on the story!

I played MUDs for several years, at the same time that I was learning the ins
and outs of programming. I developed some plugins for a popular third-party
client called MUSHclient. The game I played also had a somewhat proprietary
first-party client, and they used a spare Telnet option (one left unassigned
by IANA [1]) to pass data from the server to the client to drive some extra
graphical widgets on their client. I got involved in developing plugins that
made use of that data, which led me to learning how to negotiate that option
with the server and get the data I wanted.

I eventually started developing my own MUD client, which is where the Telnet
stack came in. Now, writing a Telnet stack is just something I do when I learn
a new language. It's just large enough of a project to exercise some
architectural and API-level concerns.

[1] If you're curious, all of the formally allocated Telnet options are
documented here: [https://www.iana.org/assignments/telnet-options/telnet-
optio...](https://www.iana.org/assignments/telnet-options/telnet-
options.xhtml)

------
userbinator
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.

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.

~~~
andrewstuart
>> Despite my general distaste for JS largely due to websites tending to abuse
it more than anything

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.

~~~
root_axis
JS is the new PHP. It's really popular (i.e. lots of n00bs) and not at all
elegant, so the programmer elite regard it with derision.

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.

~~~
tuesdayrain
> JS is the new PHP. It's really popular (i.e. lots of n00bs) and not at all
> elegant, so the programmer elite regard it with derision.

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.

~~~
root_axis
I don't think JS/TS is that bad, but it's certainly pretty far from elegant.
TS adds decent type support which helps tamp down on dynamic complexity but
rust, go, kotlin, c#, swift, ocml even java are all much more elegant
languages. I realize that elegance is largely subjective so I won't belabor
the point, but it's a pretty widely accepted subjective assessment.

------
anderspitman
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 _hasn 't_ done?

EDIT: tombert beat me to it[0] by a couple minutes.

[0]
[https://news.ycombinator.com/item?id=20413498](https://news.ycombinator.com/item?id=20413498)

~~~
MuffinFlavored
He's probably worth $300-$500/hr if not $1k...

~~~
anderspitman
Can you really put a number on this level of skill and productivity?

~~~
shsh
Yeah... his current employer already does.

~~~
MuffinFlavored
Do you know who his current employer is (if any)?

~~~
Riada
He has his own company now with another partner
([https://www.amarisoft.com/](https://www.amarisoft.com/)) where they work on
and distribute the LTE software he wrote.

~~~
metamet
Well, the scrolljacking is evidence no one is infallible. ;)

~~~
allover
Well, not all lazy HN commentary, like criticisms of 'scrolljacking' should be
taken seriously. ;)

------
gfodor
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 _very_ nice tool to have in hand.)

~~~
apaprocki
2019+ will Atwood's law compiled to WASM.

My co-worker Jason wrote a JS engine in Rust, Boa
([https://github.com/jasonwilliams/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://www.youtube.com/watch?v=_uD2pijcSi4)

~~~
dmix
Could these be able to do SSR for Vue from a Rust web server?

~~~
nkozyra
Would a JS engine be able to do all the browser/dom work on its own? I'd think
you'd need to bring along enough side cars that you might as well just use
puppeteer

------
a_lieb
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.

[1]
[https://bellard.org/quickjs/bench.html](https://bellard.org/quickjs/bench.html)

~~~
bakery2k
I have a small, CPU-intensive benchmark which shows the performance of QuickJS
to be comparable to other interpreters written in C. It's on par with
MicroPython and recent versions of Ruby, and a little faster than CPython and
Lua.

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.

~~~
penagwin
Thanks, those were the numbers I was really interested in.

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.

------
writepub
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

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](https://en.wikipedia.org/wiki/Fabrice_Bellard)

[2]: [https://bellard.org/quickjs/quickjs.html#qjsc-
compiler-1](https://bellard.org/quickjs/quickjs.html#qjsc-compiler-1)

~~~
sdegutis
The fact of its author and its extremely recent release date give this library
significantly more credibility than any other similar "embedded JS" library.
It may possibly be the best one available to date.

------
mhd
Note that Bellard already wrote a (small) HTML/CSS engine for his Emacs clone.
So we're only a small step away from Bellard-Browser.

~~~
yellowapple
Wait, he has an Emacs clone, too?

EDIT: [https://bellard.org/qemacs/](https://bellard.org/qemacs/)

------
q3k
qwertyoruiopz already found a use-after-free bug:
[https://twitter.com/qwertyoruiopz/status/1149424025111801858](https://twitter.com/qwertyoruiopz/status/1149424025111801858)

~~~
megous
There are other bugs, too, like:

    
    
        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. :)

~~~
littlestymaar
This is still an important reminder that literally nobody in the world can
write C code without memory issues.

Even if the developer is a genius and the project isn't that big.

~~~
megous
This one is probably easily catchable even by a static code analysis, though.

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

------
divs1210
This is super impressive!

Also - Yay! Another awesome target for ClojureScript - capable of producing
standalone binaries!

~~~
vim-guru
Yeah, interesting..

------
errantspark
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.

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.

------
beagle3
... and facebook releases Hermes JS Engine the same day. Coincidence, or
conspiracy?

Link on frontpage at this point in time:
[https://news.ycombinator.com/item?id=20412588](https://news.ycombinator.com/item?id=20412588)

------
duxup
I have a potentially dumb question as I'm way out of my element here.

What would someone....do with this?

Use it to run JS on some embedded device where you can run C?

~~~
CamperBob2
I have a domain-specific Windows application that uses Google's V8 engine for
hosting user-written scripts. It hasn't been upgraded for several years, and
when I recently took a look at updating the V8 version it's linked with, I was
dismayed at how bloated and complex V8 has become. Seems like it can't be
compiled down to a single DLL anymore, at least not without turning the
compilation into a miniature research project in itself.

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.

~~~
duxup
Thank you for your example!

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 ;)

~~~
CamperBob2
Correct, the application acquires data from hardware and allows the user to
access it from their own JavaScript code. This is useful for automated test,
report generation, debugging, things like that. Crashing is bad for customer
relations. :) V8 has performed well in that regard, no complaints there. I
just don't see why it has to be so massive.

------
bobajeff
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?

~~~
saagarjha
Apparently the garbage collection algorithm is reference counting with cycle
removal: [https://bellard.org/quickjs/quickjs.html#Garbage-
collection](https://bellard.org/quickjs/quickjs.html#Garbage-collection).
Swift does pure reference counting, relying on the programmer to annotate
references so that there are no cycles (which is untenable in JavaScript, due
to the way the language is designed).

~~~
aspirin
Curious what ”The cycle removal algorithm only uses the reference counts and
the object content” means in practice. Is it based on some well known
algorithm?

~~~
pcwalton
From the description it's probably a Bacon cycle collector. The basic idea is
that it checks to see whether reference counts for all objects in a subgraph
of the heap are fully accounted for by other objects in that subgraph. If so,
then it's a cycle, and you can delete one of the edges to destroy the cycle.
Otherwise, one of the references must be coming from "outside" (typically, the
stack) and so the objects cannot be safely destroyed. It's a neat algorithm
because you don't have to write a stack scanner, which is one of the most
annoying parts of a tracing GC to write.

------
pcwalton
quickjs.c is a 47,842 line C file. I think that sets the record for the
largest handwritten file I've seen.

~~~
kizer
Although decomposition into corresponding files is the norm, it’s so
satisfying to say “hey, check out my JS engine” and point people to a single
work-of-art uberfile. LOL.

~~~
dang
" _Don 't be snarky._"

" _Please don 't post shallow dismissals, especially of other people's work. A
good critical comment teaches us something._"

[https://news.ycombinator.com/newsguidelines.html](https://news.ycombinator.com/newsguidelines.html)

~~~
kizer
It wasn’t sarcasm. I was being sincere.

~~~
dang
I believe you, but a comment like that is going to pattern-match to the
internet default, which is snark, in nearly every reader's mind.

~~~
ibly31
I think you are overreacting here, his comment was definitely not interpreted
as sarcastic. Quite the opposite, it was showing appreciation for what an
achievement QuickJS is.

------
jerome_k
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.

Hopefully QuickJS won't discourage the author of Duktape from making future
releases of his incredible small low-memory JS engine.

~~~
ricardobeat
What's to like about it? First thing I wanted to do is look at the sources,
which is now a multiple-step process - especially since I'm on windows and
usually work on a Mac. Not to mention mobile.

~~~
j605
Both can decompress tarballs. No idea if mobile ever crossed their mind.

~~~
penagwin
Windows can't extract tarballs unless you install the linux subsystem or
install 7-zip or similar.

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.

------
snappybear
Can not pass tests from armv8l, the site seems no bug report links. is anyone
know how to let bellard know this ?

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)

~~~
snappybear
other error find from android termux:

InternalError: out of memory in regexp execution at test_regexp
(tests/test_builtin.js:427) at <eval> (tests/test_builtin.js:594)

------
iforgotpassword
Now finally, kernel space JavaScript is in reach! ;-)

~~~
finder83
That's horrifying

~~~
aneutron
Wait til someone hijacks the nfs driver repo on npm. That's where the real fun
begins.

------
zerr
Why are we ignoring the second author? :)

~~~
simlevesque
who is this Charlie Gordon ?

~~~
fvdessen
Seems like a pseudonym; Charlie Gordon is the name of the protagonist in
Flowers for Algernon.

~~~
basementcat
> Seems like a pseudonym; Charlie Gordon is the name of the protagonist in
> Flowers for Algernon.

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.

------
andyfleming
Will the source of this be published to github (or similar) for contributing?

~~~
techntoke
Not my site, but a recommendation:

[https://git-send-email.io/](https://git-send-email.io/)

------
NuclearFishin
How does one keep track of Fabrice Bellard's work? I couldn't find a Twitter
profile, GitHub profile, or RSS feed from his website.

~~~
userbinator
[https://bellard.org/](https://bellard.org/)

[https://bellard.org/projects.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.

~~~
penagwin
He has a drive that most people can only dream of.

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.

------
mstade
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.

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?

~~~
btmills
Try adding the `--module` flag [1]. JS now has two different grammars, script
and module, and the `import` keyword is only allowed in module code.

[1] [https://bellard.org/quickjs/quickjs.html#qjs-
interpreter](https://bellard.org/quickjs/quickjs.html#qjs-interpreter)

~~~
mstade
Ah yes of course – thanks, works as advertised now! :o)

Really cool stuff!

------
miguelmota
Freaking impressive and incredibly performant.

Imposter syndrome kicks in when I see how much Fabrice has accomplished.

What a legend.

------
ddalex
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!

------
wheresvic1
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:

    
    
        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...](https://github.com/smalldatatech/quickjs/blob/master/examples/default_modules.js)

~~~
swuecho

        import * as std from "std";
        import * as os from "os";
    
        std.printf("%d\n", 1);
        std.printf("%s\n", os.platform)

~~~
wheresvic1
Awesome thanks!

------
vkaku
He does it again. The other small footprint engine used to be Jerry

------
megous
Very nice repl with syntax highlighting.

------
mirekrusin
Is it possible to contribute a patch? How should I do it?

~~~
jerome_k
from [https://bellard.org](https://bellard.org) ...

If you have any questions or suggestions, write to fabrice at bellard

------
lxe
> 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.

This is peak JavaScript. How deep can we go?

~~~
thomasfortes
Your comment reminded me of this talk:
[https://www.destroyallsoftware.com/talks/the-birth-and-
death...](https://www.destroyallsoftware.com/talks/the-birth-and-death-of-
javascript)

------
aboodman
I'm curious - what is/was the intended application of this?

~~~
oscargrouch
A very small and fast javascript interpreter. It will create a small library
file for the programs who depends on this and according to the benchmarks it
runs faster than the other javascript interpreters.

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).

~~~
aboodman
Right - I'm wondering if Fabrice had a particular embedder in mind for this JS
engine. It seems like a big effort to go to just for the hell of it.

------
agumonkey
I wonder how different jslinux (obviously) would behave on it.

------
rick22
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.

------
heapjs
Would it be possible to compile a nodejs app to a binary with this? If so,
would performance be any better?

~~~
mstade
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 dependencies.

~~~
dpacmittal
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.

~~~
exebook
fs/net and some other important pieces of Node.js are written as C++ addons
for v8, hooking them would be very difficult I guess. Though Microsoft have
been working on this for their ChakraCore engine. There was a conflict if I
recall correctly, Microsoft suggested to add another abstraction layer to make
hooking other JS engines easier but Node.js team refused it. I might not know
that situation very well. But I have downloaded ChakraCore based Node.js once
and it ran my project without problems, though the performance was about 5%
slower.

~~~
MuffinFlavored
How could we easily expose syscalls to `qjs`? Deno is just a Rust IPC/syscall
layer glued to V8 really...

~~~
mstade
Some Node APIs could probably be implemented using the std and os modules[1],
but others (e.g. networking) would probably need to be implemented via the C
API[2].

[1]: [https://bellard.org/quickjs/quickjs.html#Standard-
library](https://bellard.org/quickjs/quickjs.html#Standard-library)

[2]: [https://bellard.org/quickjs/quickjs.html#QuickJS-C-
API](https://bellard.org/quickjs/quickjs.html#QuickJS-C-API)

~~~
dariojcravero
Perhaps libuv-webserver[1] could be used for that purpose?

[1]: [https://github.com/springmeyer/libuv-
webserver](https://github.com/springmeyer/libuv-webserver)

------
dodo6502
Would this be a suitable replacement for SpiderMonkey as an embedded JS engine
for a Desktop Application?

~~~
TAForObvReasons
Many projects use duktape ([https://duktape.org/](https://duktape.org/))

~~~
megous
There's also XS6 engine. But I dislike the macro trickery in that one.

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.

~~~
megous
So I used QuickJS for a while today and it's the easiest JS engine of those I
used so far (Duktape, XS6) to embed, even without extensive docs.

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.

------
duchenne
I have question. Do you think that this could be used as a brick to build an
alternative web browser?

------
andyfleming

      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?

~~~
pjscott
Yeah, I got the same error, along with a bunch of warnings earlier in the
build about how 32-bit builds are deprecated on recent macOS versions. And
then when it goes to link, it can't find the 32-bit symbols for functions like
sqrt() and `printf()`.

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.

~~~
andyfleming
Thanks! That solved it for me.

------
ilaksh
How fast is it compared to V8?

~~~
wanjochan
by linking c modules, comparing it with v8 is no longer meaningful

------
amrox
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

~~~
fangzhzh
Curious too. Anyone help pointing a way how to verify the possibility?

------
suhail
quickjs.c is 47,842 lines of non-generated code. :mindblown:

~~~
winrid
Heh, and I work where some complain about 5k line Java files.

~~~
t0astbread
5k line Java files sounds awful

~~~
TheRealSteel
The thing about a 5,000 line Java file is that it's Java, so it's probably
also 5,000 columns.

------
kostadin
The operator overloading is potentially huge. Along with the BigInt/Float
extensions, it makes it a great target for scientific computing applications.

------
rick22
At the bottom of the page there is this the mention of "Charlie Gordon". Who
is he ?. Any place to find the works of him.

------
molsson
Very impressive!

~~~
stcredzero
This is fast enough, it could be used to write command line utilities in
Javascript! What about a Javascript OS in the style of the Lisp machines or
early Smalltalks?

~~~
kybernetikos
Record-query [1] embeds v8 for its query language, which seems to add a
significant amount of heft. I know that couchdb uses js for querying as well.
It seems like this could be another option for something like that.

[1] [https://github.com/dflemstr/rq](https://github.com/dflemstr/rq)

~~~
xvilka
Convert the QuickJS code into Rust using c2rust[1], then reuse in rq.

[1] [https://github.com/immunant/c2rust](https://github.com/immunant/c2rust)

------
Scarbutt
The death of Lua.

~~~
detailyang
Agreen. If I choose the embedded language luajit or quickjs is my best
options:)

------
londons_explore
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...

------
steipete
There's no issue tracker?

~~~
arebours
There is a TODO file

