Page 1 of 1

[Some news] QuickJS Javascript Engine

Posted: 2019-07-13, 08:20
by Al6bus
French mathematician Fabrice Bellard, better known for working on ffmpeg, qemu, tcc and calculating pi, laid out QuickJS, a compact implementation of JavaScript as a C-language library, in open access.
QuickJS is a small and embeddable Javascript engine. It supports the ES2019 specification including modules, asynchronous generators and proxies.

It optionally supports mathematical extensions such as big integers (BigInt), big floating point numbers (BigFloat) and operator overloading.

Main Features:
  • Small and easily embeddable: just a few C files, no external dependency, 190 KiB of x86 code for a simple hello world program.
  • Fast interpreter with very low startup time: runs the 56000 tests of the ECMAScript Test Suite in about 100 seconds on a single core of a desktop PC. The complete life cycle of a runtime instance completes in less than 300 microseconds.
  • Almost complete ES2019 support including modules, asynchronous generators and full Annex B support (legacy web compatibility).
  • Passes 100% of the ECMAScript Test Suite.
  • Can compile Javascript sources to executables with no external dependency.
  • Garbage collection using reference counting (to reduce memory usage and have deterministic behavior) with cycle removal.
  • Mathematical extensions: BigInt, BigFloat, operator overloading, bigint mode, math mode.
  • Command line interpreter with contextual colorization implemented in Javascript.
  • Small built-in standard library with C library wrappers.
https://bellard.org/quickjs/
https://news.ycombinator.com/item?id=20411154

Re: [Some news] QuickJS Javascript Engine

Posted: 2019-07-13, 10:59
by Moonchild
What are you suggesting, that we replace SpiderMonkey with this?

Re: [Some news] QuickJS Javascript Engine

Posted: 2019-07-13, 11:28
by Al6bus
I do not offer anything, just inform. it may be useful in the future :think:

Re: [Some news] QuickJS Javascript Engine

Posted: 2019-07-13, 12:59
by Moonchild
It's not possible to just swap out the JS engine (even if it was a separate, embeddable dll or whatnot) because it's tightly intertwined with DOM in a browser.
The JS engine might have full language support for the scripting, but that doesn't mean anything without being able to have it interact with DOM structures, and in turn page content, at many levels. It works great for standalone JS programs, of course, but that's all there is to it.

Re: [Some news] QuickJS Javascript Engine

Posted: 2019-07-13, 15:00
by Al6bus
I understood. Thanks for the clarification.

Re: [Some news] QuickJS Javascript Engine

Posted: 2019-07-13, 15:02
by Isengrim
Moonchild wrote:
2019-07-13, 12:59
It's not possible to just swap out the JS engine (even if it was a separate, embeddable dll or whatnot) because it's tightly intertwined with DOM in a browser.
Would it theoretically be possible to create a browser with swappable JS engines, rather than trying to modify an existing one? Or would that be "highly impractical or improbable"?

Re: [Some news] QuickJS Javascript Engine

Posted: 2019-07-13, 16:09
by Moonchild
Isengrim wrote:
2019-07-13, 15:02
Or would that be "highly impractical or improbable"?
I'd say highly impractical, impossible to maintain, and improbable.