Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.11 #6

Merged
merged 6 commits into from
Jan 14, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions _includes/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@

<div class="trigger">
<a href="https://boa-dev.github.io/boa/dev/bench/">Benchmarks</a> |
<a href="https://boa-dev.github.io/boa/test262/">Conformance</a> |
<a href="https://boa-dev.github.io/boa/">Playground</a> |
<a href="https://boa-dev.github.io/boa/doc/boa/index.html">Docs</a>
</div>
Expand Down
66 changes: 66 additions & 0 deletions _posts/2021-01-10-boa-release-11.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
layout: post
title: "Boa release v0.11"
author: Boa Developers
---

Boa has reached a new release. v0.11, our biggest one yet. Since v0.10 we've closed 77 issues, merged 129 pull requests. The engine has been faster and more compliant to the spec. Below are some of the highlights but please see the [changelog link] for more information.

## Test 262
Razican marked this conversation as resolved.
Show resolved Hide resolved

Test262 is the implementation conformance test suite maintained by TC39. It's used by nearly all engines to measure how conformant they are to the specification. Boa pulls the tests in-tree and runs against PRs and on a nightly basis. Test262 doesn't sit still, so since the last release we've updated our reference to make sure we're running against the latest spec. You can find more about Test262 [here](https://github.com/tc39/test262).
Copy link
Contributor

@RageKnify RageKnify Jan 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the term nightly fits here, what do you think?

Suggested change
Test262 is the implementation conformance test suite maintained by TC39. It's used by nearly all engines to measure how conformant they are to the specification. Boa pulls the tests in-tree and runs against PRs and on a nightly basis. Test262 doesn't sit still, so since the last release we've updated our reference to make sure we're running against the latest spec. You can find more about Test262 [here](https://github.com/tc39/test262).
Test262 is the implementation conformance test suite maintained by TC39. It's used by nearly all engines to measure how conformant they are to the specification. Boa pulls the tests in-tree and runs them against all PRs. Test262 doesn't sit still, so since the last release we've updated our reference to make sure we're running against the latest spec. You can find more about Test262 [here](https://github.com/tc39/test262).


Since v0.10 we have almost doubled on spec conformance, and reduced panics from hundreds to less than 50. A year ago Boa didn't even track itself against Test262 so it was difficult to know how compliant we were to the spec, today not only do we track all changes against Test262 but we can see progress on a PR to PR basis.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Since v0.10 we have almost doubled on spec conformance, and reduced panics from hundreds to less than 50. A year ago Boa didn't even track itself against Test262 so it was difficult to know how compliant we were to the spec, today not only do we track all changes against Test262 but we can see progress on a PR to PR basis.
Since v0.10 we have almost doubled on spec conformance, and reduced panics from hundreds to 25 (tracked in [#817](https://github.com/boa-dev/boa/issues/817)). A year ago Boa didn't even track itself against Test262 so it was difficult to know how compliant we were to the spec, today not only do we track all changes against Test262 but we can see progress on a PR to PR basis.


For live tracking of conformance tests you can check [here](https://boa-dev.github.io/boa/test262/). Below is a snapshot of the previous version and today.

<div class="row" style="display: flex; justify-content: space-around;">
<section class="col-md-4" style="" id="version-latest"><div class="card"><div class="card-body"><h3>v0.10:</h3><ul class="list-group list-group-flush"><li class="list-group-item">Total tests: <span class="total-tests">38,706</span></li><li class="list-group-item">Passed tests: <span class="passed-tests">6,960</span></li><li class="list-group-item">Ignored tests: <span class="ignored-tests">5,748</span></li><li class="list-group-item">Failed tests: <span class="failed-tests">25,998</span></li><li class="list-group-item">Conformance: <b>17.98%</b></li></ul><div class="info-link"><a class="card-link" href="#"><span class="info-link"></span></a></div></div></div></section>
<section class="col-md-4" style="" id="master-latest"><div class="card"><div class="card-body"><h3>v0.11:</h3><ul class="list-group list-group-flush"><li class="list-group-item">Total tests: <span class="total-tests">78,497</span></li><li class="list-group-item">Passed tests: <span class="passed-tests">24,550</span></li><li class="list-group-item">Ignored tests: <span class="ignored-tests">15,585</span></li><li class="list-group-item">Failed tests: <span class="failed-tests">38,362 (24 ⚠)</span></li><li class="list-group-item">Conformance: <b>31.28%</b></li></ul><div class="info-link"><a class="card-link" href="#"><span class="info-link"></span></a></div></div></div></section>
<section class="col-md-4" style="display: none" id="old-versions"></section>
</div>

## Regress

In this release Boa switched from its own implementation (wrapping `regex`) to the [`regress`](https://github.com/ridiculousfish/regress) engine for regular expressions. Regress is a crate aiming to implement ECMAScript compliant regular expressions and Boa makes use (and contributes back to) that.

While Regress is not 100% spec compliant this is something which is being worked on, also the switch gave us quite a performance boost in our [benchmarks](https://boa-dev.github.io/boa/dev/bench/) we're seeing almost 6X faster execution.

<picture>
<source srcset="/images/2021-09-11/regex-bench-dark.png" media="(prefers-color-scheme: dark)">
<img src="/images/2021-09-11/regex-bench-white.png">
</picture>

The above image shows a big drop in the middle of the graph, above `fb1b8d5` is where we switched over. Conformance went from 19.01% to 18.99% and introduced some panics, however many of those have since been fixed.

## Iterating over bytes

Previously the lexer iterated over Unicode chars (u32 code points), this wasn't strictly neccesary for Boa and we have instead changed the lexer to work over bytes (u8). Iterating over bytes rather than chars is inherently much faster, non-ascii UTF8 bytes are all >=128, and we might only really care about those being correct when parsing idents. This is standard practise amongs lexical analyzers and even browsers read source code byte-by-byte, using the rules of the language's syntax to convert the source text into tokens.

This was worked on by @jevancc and his [changes](https://github.com/boa-dev/boa/pull/915/files) have improved performance overall.

## Embedding examples

We are still working on what the public API should look like, some of these decisions are driven by feedback and the constant changing way which Boa works.
Not only you can run Boa against javascript today you can also embed your own objects and classes into the engine before it's ran.

We've offered an [example](https://github.com/boa-dev/boa/blob/master/boa/examples/classes.rs) to show how a class can be constructed in Rust then added to the environment before executing your scripts.
This should offer a great insight into how you can interop Rust with JavaScript by using Boa.

If there are any examples you would like added, please raise an issue on the main repository.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are missing some examples until boa-dev/boa#634 (or an equivalent PR) get merged. Should we add some code examples here? Or at least mention that using a Context we can register global functions, global classes and so on.

We could mention the Context::register_global_function(), Context::register_global_class() and Context::register_global_property() functions, to make our users understand how to extend Boa.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I like the sound of that


## Generating bytecode

Today Boa walks the tree of the AST, although easy to implement it's not ideal for performance.
We are loooking to do code generation which can then be interpreted. This gradual process may happen over many releases until at some point we can switch implementations under the hood. Our steps are:

- ~~Experiment with VM Path on isolated branch~~
- ~~Experiment with generating more simpler instructions~~
- Build up parity with current implementation
- Run test suite over VM path including conformance tests
- Switch over once performance is steady
- Optimize code generation and intreperter
RageKnify marked this conversation as resolved.
Show resolved Hide resolved

## Thank You

Everything in this release has been such a huge effort, we thank everyone who contributed, whether it was features, fixes or raising bugs.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I would mention the contributors since the last release. Especially for the ones outside of the org, and the new memberships in the organization.

I would also add links to the good first issues and maybe also issues where help is wanted, so that potential contributors know where to start.

Binary file added images/2021-09-11/regex-bench-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/2021-09-11/regex-bench-white.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.