TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

QuickJS JavaScript Engine

948 pointsby apaprockialmost 6 years ago

44 comments

tombertalmost 6 years ago
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.
评论 #20415400 未加载
评论 #20413645 未加载
评论 #20417544 未加载
评论 #20413683 未加载
评论 #20413553 未加载
评论 #20413534 未加载
评论 #20418632 未加载
评论 #20424101 未加载
评论 #20413687 未加载
评论 #20417294 未加载
userbinatoralmost 6 years ago
Wow. The core is a single 1.5MB file that&#x27;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&#x27;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&#x27;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 &quot;space at the bottom&quot; for even smaller but functionality competitive implementations.
评论 #20417566 未加载
anderspitmanalmost 6 years ago
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&#x27;t</i> done?<p>EDIT: tombert beat me to it[0] by a couple minutes.<p>[0] <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=20413498" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=20413498</a>
评论 #20415887 未加载
评论 #20415118 未加载
评论 #20413697 未加载
gfodoralmost 6 years ago
Worth noting: the demo is a WASM-compiled instance of this engine. I&#x27;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&#x27;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.)
评论 #20415265 未加载
评论 #20417674 未加载
评论 #20414496 未加载
评论 #20417686 未加载
评论 #20418637 未加载
评论 #20416673 未加载
a_liebalmost 6 years ago
The benchmark scores [1] he gives only stack it up against other embeddable engines. It cuts those to ribbons, but can someone who&#x27;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:&#x2F;&#x2F;bellard.org&#x2F;quickjs&#x2F;bench.html" rel="nofollow">https:&#x2F;&#x2F;bellard.org&#x2F;quickjs&#x2F;bench.html</a>
评论 #20419502 未加载
评论 #20418871 未加载
评论 #20421065 未加载
评论 #20419124 未加载
writepubalmost 6 years ago
From the documentation [2], compilation of js to c looks very interesting. If variable types are well known&#x2F;defined (like Uint8Array, ..), this effectively presents a way to derive performant binaries from js<p>For those who don&#x27;t know, the author is one of the most prolific programmers&#x2F;creators of our time. Please check his bio [1]<p>[1]: <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Fabrice_Bellard" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Fabrice_Bellard</a><p>[2]: <a href="https:&#x2F;&#x2F;bellard.org&#x2F;quickjs&#x2F;quickjs.html#qjsc-compiler-1" rel="nofollow">https:&#x2F;&#x2F;bellard.org&#x2F;quickjs&#x2F;quickjs.html#qjsc-compiler-1</a>
评论 #20412779 未加载
评论 #20412683 未加载
mhdalmost 6 years ago
Note that Bellard already wrote a (small) HTML&#x2F;CSS engine for his Emacs clone. So we&#x27;re only a small step away from Bellard-Browser.
评论 #20414265 未加载
评论 #20416495 未加载
q3kalmost 6 years ago
qwertyoruiopz already found a use-after-free bug: <a href="https:&#x2F;&#x2F;twitter.com&#x2F;qwertyoruiopz&#x2F;status&#x2F;1149424025111801858" rel="nofollow">https:&#x2F;&#x2F;twitter.com&#x2F;qwertyoruiopz&#x2F;status&#x2F;1149424025111801858</a>
评论 #20417110 未加载
divs1210almost 6 years ago
This is super impressive!<p>Also - Yay! Another awesome target for ClojureScript - capable of producing standalone binaries!
评论 #20419808 未加载
errantsparkalmost 6 years ago
I can&#x27;t wait to mess around with this, it look super cool. I love the minimalist approach, if it&#x27;s truly spec compliant I&#x27;ll be using this to compile down a bunch of CLI scripts I&#x27;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&#x27;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.
beagle3almost 6 years ago
... and facebook releases Hermes JS Engine the same day. Coincidence, or conspiracy?<p>Link on frontpage at this point in time: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=20412588" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=20412588</a>
duxupalmost 6 years ago
I have a potentially dumb question as I&#x27;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?
评论 #20417158 未加载
评论 #20417044 未加载
评论 #20417149 未加载
bobajeffalmost 6 years ago
I&#x27;m curious as to how the reference counting works in this. Is it comparable to what&#x27;s used in Swift? How is it compared to the methods typically used in V8 and Spider Monkey?
评论 #20413561 未加载
评论 #20413435 未加载
pcwaltonalmost 6 years ago
quickjs.c is a 47,842 line C file. I think that sets the record for the largest handwritten file I&#x27;ve seen.
评论 #20415246 未加载
评论 #20413101 未加载
jerome_kalmost 6 years ago
I like that Bellard released the source code in old school tar format rather than on github. The world&#x27;s code collaboration platform is of little use to the world&#x27;s best programmer.<p>Hopefully QuickJS won&#x27;t discourage the author of Duktape from making future releases of his incredible small low-memory JS engine.
评论 #20415077 未加载
iforgotpasswordalmost 6 years ago
Now finally, kernel space JavaScript is in reach! ;-)
评论 #20413758 未加载
snappybearalmost 6 years ago
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 .&#x2F;qjs tests&#x2F;test_closure.js .&#x2F;qjs tests&#x2F;test_op.js .&#x2F;qjs tests&#x2F;test_builtin.js Error: assertion failed: got |2e+1|, expected |3e+1| at assert (tests&#x2F;test_builtin.js:17) at test_number (tests&#x2F;test_builtin.js:307) at &lt;eval&gt; (tests&#x2F;test_builtin.js:589)
评论 #20420294 未加载
zerralmost 6 years ago
Why are we ignoring the second author? :)
评论 #20415701 未加载
评论 #20415065 未加载
andyflemingalmost 6 years ago
Will the source of this be published to github (or similar) for contributing?
评论 #20416173 未加载
评论 #20415523 未加载
NuclearFishinalmost 6 years ago
How does one keep track of Fabrice Bellard&#x27;s work? I couldn&#x27;t find a Twitter profile, GitHub profile, or RSS feed from his website.
评论 #20417515 未加载
评论 #20417997 未加载
mstadealmost 6 years ago
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&#x27;t matter much I went ahead and ran `.&#x2F;qjs examples&#x2F;hello.js` which worked as advertised – cool! Tried `.&#x2F;qjsbn examples&#x2F;pi.js 5` and it worked as well – very cool! Then I tried `.&#x2F;qjs examples&#x2F;hello_module.js` and got this:<p><pre><code> SyntaxError: unsupported keyword: import at examples&#x2F;hello_module.js:3 </code></pre> I don&#x27;t know what I did wrong – anyone else try it yet?
评论 #20413487 未加载
评论 #20413989 未加载
评论 #20413493 未加载
vkakualmost 6 years ago
He does it again. The other small footprint engine used to be Jerry
miguelmotaalmost 6 years ago
Freaking impressive and incredibly performant.<p>Imposter syndrome kicks in when I see how much Fabrice has accomplished.<p>What a legend.
ddalexalmost 6 years ago
I was like &quot;oh no, not another JS engine&quot;, and then I&#x27;ve seen it&#x27;s on bellard.org... and I thought to myself, ok, this is the future!
wheresvic1almost 6 years ago
I&#x27;m asking this here because I don&#x27;t really know where else to do so: I&#x27;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(&quot;%d\n&quot;, 1); std.printf(&quot;%s\n&quot;, os.platform); </code></pre> However it does not compile to a binary and doing something like:<p><pre><code> import std from &quot;std&quot;; import os from &quot;os&quot;; std.printf(&quot;%d\n&quot;, 1); std.printf(&quot;%s\n&quot;, os.platform); </code></pre> compiles via `.&#x2F;qjsc -m -o default_modules examples&#x2F;default_modules.js` however does not execute:<p><pre><code> $ .&#x2F;default_modules SyntaxError: export &#x27;default&#x27; in module &#x27;std&#x27; is ambiguous </code></pre> Source: <a href="https:&#x2F;&#x2F;github.com&#x2F;smalldatatech&#x2F;quickjs&#x2F;blob&#x2F;master&#x2F;examples&#x2F;default_modules.js" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;smalldatatech&#x2F;quickjs&#x2F;blob&#x2F;master&#x2F;example...</a>
评论 #20421354 未加载
aboodmanalmost 6 years ago
I&#x27;m curious - what is&#x2F;was the intended application of this?
评论 #20416870 未加载
评论 #20416662 未加载
评论 #20425848 未加载
megousalmost 6 years ago
Very nice repl with syntax highlighting.
heapjsalmost 6 years ago
Would it be possible to compile a nodejs app to a binary with this? If so, would performance be any better?
评论 #20413297 未加载
评论 #20413716 未加载
评论 #20413395 未加载
评论 #20427622 未加载
mirekrusinalmost 6 years ago
Is it possible to contribute a patch? How should I do it?
评论 #20416176 未加载
评论 #20413874 未加载
lxealmost 6 years ago
&gt; An online demonstration of the QuickJS engine with its mathematical extensions is available at numcalc.com. It was compiled from C to WASM&#x2F;asm.js with Emscripten.<p>This is peak JavaScript. How deep can we go?
评论 #20417146 未加载
agumonkeyalmost 6 years ago
I wonder how different jslinux (obviously) would behave on it.
rick22almost 6 years ago
Does Fabrice Bellard knows any other language other than &#x27;c&#x27; ?. Looks all his works are in &#x27;c&#x27;. 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.
dodo6502almost 6 years ago
Would this be a suitable replacement for SpiderMonkey as an embedded JS engine for a Desktop Application?
评论 #20413219 未加载
duchennealmost 6 years ago
I have question. Do you think that this could be used as a brick to build an alternative web browser?
andyflemingalmost 6 years ago
<p><pre><code> Undefined symbols for architecture i386 </code></pre> I get this error when attempting to make on macOS.<p>I don&#x27;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?
评论 #20416668 未加载
ilakshalmost 6 years ago
How fast is it compared to V8?
评论 #20437617 未加载
amroxalmost 6 years ago
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&#x2F;Android) too
评论 #20417142 未加载
评论 #20444632 未加载
suhailalmost 6 years ago
quickjs.c is 47,842 lines of non-generated code. :mindblown:
评论 #20417919 未加载
评论 #20414183 未加载
kostadinalmost 6 years ago
The operator overloading is potentially huge. Along with the BigInt&#x2F;Float extensions, it makes it a great target for scientific computing applications.
rick22almost 6 years ago
At the bottom of the page there is this the mention of &quot;Charlie Gordon&quot;. Who is he ?. Any place to find the works of him.
molssonalmost 6 years ago
Very impressive!
评论 #20412829 未加载
Scarbuttalmost 6 years ago
The death of Lua.
评论 #20417720 未加载
评论 #20418500 未加载
londons_explorealmost 6 years ago
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...
steipetealmost 6 years ago
There&#x27;s no issue tracker?
评论 #20422659 未加载