Skip to main content

Boa release v0.15

· 5 min read

Summary

Boa v0.15 is now available! After around 3 months of development, we are very happy to present you the newest release of the Boa JavaScript engine. Boa makes it easy to embed a JS engine in your projects, and you can even use it from WebAssembly. See the about page for more info.

Boa currently supports part of the JavaScript language. In this release, our conformance has grown from 49.74% to 62.29% in the official ECMAScript Test Suite (Test262). The engine now passes 56,372 tests, coming from 43,986 in Boa 0.14 (28.1% increase), and we have closed 18 issues and merged 58 pull requests. You can check the full list of changes here, and the full information on conformance here.

New ECMAScript features

While there are only a few big new features in this release, there are a lot of fixes for existing features that should enable many more JavaScript programs to execute correctly. For a detailed list checkout the changelog.

Support for Classes

With this new release boa ships with support for ECMAScript Classes. While not all features are implemented, most basic functionality should work as expected.

class Rectangle {
constructor(height, width) {
this.height = height;
this.width = width;
}

calcArea() {
return this.height * this.width;
}

get area() {
return this.calcArea();
}
}

let r = new Rectangle(2, 4);
r.calcArea(); // 8

Support for eval() and Function()

While eval() is one of the less popular Javascript features, many tests in the ECMAScript Test Suite use it. For a better representation of passing tests and to fully comply with the specification we have implemented it and the similar Function() constructor. We would like to echo the mdn docs and point out to Never use eval()!

eval('console.log("Never use eval()!")');

let f = Function("arg", 'console.log("This is also a very " + arg + " idea!")');
f("bad");

Thanks to @raskad for working on classes, eval() and Function(), among many other things!

Regaining Performance

After moving from an AST based execution to our Virtual Machine we observed performance losses in some of our benchmarks. We found out that the root-cause of these losses was a single format!() call in the hot-path of the VM. Our assumption was that the formatting logic would be optimized out by rustc or llvm, because it was used as an argument to an empty (feature-gated) function. After replacing the format!() call with a &'static str the expected optimization took place and we were back to previous performance levels. For more details check out #1973 for the changes and some discussion about this issue. Thanks to @pdogr for finding the issue and contributing a fix.

Starting work on Internationalization

ECMAScript specifies an Internationalization API through the Intl global object. We have started implementing many internal functions and structures to provide the Intl object in boa. To take advantage of existing work in this space we have started integrating the ICU4X library into boa. Thanks to @NorbertGarfield and @jedel1043 for their continued work on this topic.

Rust Wrappers for Javascript Objects

We have started the implementation of wrappers around built-in Javascript objects like Array. These Rust types make it easy to work with Javascript objects in Rust and provide a type safe abstraction around them. Many of these wrappers are not implemented yet and may be a good place to start contributing to boa. If you are interested, check out the tracking issue.

How can you contribute to Boa?

In March, boa opened financial contributions on its OpenCollective page. Since then, we have to thank Demergent Labs, a company using Boa in the Internet Computer that has decided to sponsor us, and Clemens Koza, who is our first backer! We are already thinking on how we will use these contributions to improve how we develop Boa.

If financial contribution is not your strength, you can contribute by asking to be assigned to one of our open issues, and asking for mentoring if you don't know your way around the engine. Our contribution guide should help you here. If you are more used to working with JavaScript or frontend web development, we also welcome help to improve our web presence, either in our website, or in our testing representation page or benchmarks page. You can also contribute to our Criterion benchmark comparison GitHub action.

We are also looking to improve the documentation of the engine, both for developers of the engine itself and for users of the engine. Feel free to contact us in Discord.

Thank You

Last but certainly not least, a big Thank You to all the contributors of this Boa release. We would like to particularly thank our new contributors: