days
-1
-4
hours
-2
0
minutes
-3
-5
seconds
-1
-9
search
Fabrice Bellard's latest creation

Small embeddable JavaScript engine with QuickJS

Sarah Schlothauer
javascript
© Shutterstock / frank_peters

Programming legend Fabrice Bellard released a new project: the QuickJS JavaScript Engine landed with its first public release. This small, embeddable JS engine consists of just a few simple C files. Check out the benchmarks compared to other JS engines such as JerryScript and see how it performs.

JavaScript programmers, rejoice. The first public release for the QuickJS JavaScript Engine landed on July 9, 2019. The QuickJS JavaScript Engine is a “small and embeddable JavaScript engine” with a compact readable core.

Fabrice Bellard and Charlie Gordon are the project’s creators. You may recognize Bellard’s name or you may recognize some of his many contributions including the Tiny C CompilerFFmpeg, and QEMU, and even a formula used to calculate the nth digit of π in base 16. His notable accomplishments don’t stop there. He also held the World Record for calculating pi to about 2700 billion decimal digits in 2009 on a single desktop computer.

What does this newest creation do?

QuickJS features

From the engine’s page, the main features include:

SEE ALSO: Don’t make it a race: The four common concurrency control patterns

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

Test it out

An interactive demonstration of the engine and its capabilities is available to test out with a scientific calculator on NumCal.com. According to Bellard’s site, this demonstration is compiled from C to WASM/asm.js with Emscripten.

SEE ALSO: How small can TinyGo squeeze down WebAssembly?

View the results from benchmark tests against other embeddable JS engines and test details.

The benchmarks prove it is lightweight. It tests better than DukTape, XS, MuJS, and the tiny IoT JS engine JerryScript. Users can download the bench-v8 source code themselves in the test archives and test other engines (provided that they can run the benchmark).

javascript

Benchmark test results. Source.

Check out the documentation for all the in-depth information about modules, language support and more. You can download the source code from the website.

This project is open-sourced under the MIT license.

Author
Sarah Schlothauer

Sarah Schlothauer

All Posts by Sarah Schlothauer

Sarah Schlothauer is an assistant editor for JAXenter.com. She received her Bachelor's degree from Monmouth University and is currently enrolled at Goethe University in Frankfurt, Germany where she is working on her Masters. She lives in Frankfurt with her husband and cat.

Leave a Reply

Be the First to Comment!

avatar
400
  Subscribe  
Notify of