Credit: Corbin Davenport / How-To Geek / Chris Williams
Published 15 minutes ago
Sign in to your How-To Geek account
Even though JavaScript was originally built for scripts in web pages, it is now used to write desktop applications, server software, and everything in between. Now, it might become an option for software on low-memory embedded systems and microcontrollers, thanks to the MicroQuickJS project.
MicroQuickJS is a new project from Fabrice Bellard, who has created many other open-source projects, including QEMU, FFmpeg, the NNCP lossless data compressor, and the JSLinux emulator. This latest effort is based on another one of his projects, [QuickJS](https://github.com/bellar…
Credit: Corbin Davenport / How-To Geek / Chris Williams
Published 15 minutes ago
Sign in to your How-To Geek account
Even though JavaScript was originally built for scripts in web pages, it is now used to write desktop applications, server software, and everything in between. Now, it might become an option for software on low-memory embedded systems and microcontrollers, thanks to the MicroQuickJS project.
MicroQuickJS is a new project from Fabrice Bellard, who has created many other open-source projects, including QEMU, FFmpeg, the NNCP lossless data compressor, and the JSLinux emulator. This latest effort is based on another one of his projects, QuickJS, which is a minimal JavaScript engine written in the C language.
The goal of MicroQuickJS is to compile and run JavaScript code "using as little as 10 kB of RAM," with the entire engine only requiring around 100 kB of ROM storage, including its C library dependency. It supports a "subset of JavaScript" close to ES5 (ECMAScript 2009), so newer features from ES6 and onwards like let and const keywords, arrow functions, and map objects are unlikely to work. It’s also stricter than a typical JavaScript engine, and blocks some error prone or inefficient operations, like arrays with holes.
The project’s documentation explains, "Although MQuickJS shares much code with QuickJS, [its] internals are different in order to consume less memory. In particular, it relies on a tracing garbage collector, the VM does not use the CPU stack and strings are stored in UTF-8."
MicroQuickJS isn’t going to replace Node.js for most projects, especially since it doesn’t seem to provide networking support or access to the device’s filesystem. However, it could be useful on devices like an Arduino board or Raspberry Pi Pico, where more common engines are not an option.
Related
What Is Node.JS and What Is It Used for?
If you’re doing any sort of web development, you’re probably going to have to learn and write JavaScript at some point. Node is meant to simplify web application development by unifying the server and client side languages.
The documentation explains some of the engine’s internal architecture, including a floating point emulator if the given processor doesn’t support that feature, and "almost no dependency on the C library." Even if the potential real-world use cases are limited, it’s an impressive undertaking.
You can visit the GitHub repository to check out the code, compile and benchmarking instructions, and more information about how the engine works. There are no binaries available at the moment, so you’ll have to compile it yourself if you want to try it out.
Source: GitHub via Simon Willison’s Weblog