Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Integrating Boa into Biome #3673

Closed
arendjr opened this issue Feb 13, 2024 · 7 comments
Closed

Integrating Boa into Biome #3673

arendjr opened this issue Feb 13, 2024 · 7 comments

Comments

@arendjr
Copy link

arendjr commented Feb 13, 2024

Hey there! I am currently investigating whether Boa could be used as an interpreter inside Biome to power its future plugin system. The fact that Boa is written in Rust is surely a pre, since it should make it easier for us to integrate. The fact you've already seemingly done a good job of separating core functionality into several crates makes it even more attractive.

A few questions to start off the discussion:

  • I see you've already set up conformance tests, which is great! Can you tell in a few words/sentences what are the biggest areas where you feel Boa is most incomplete?
  • Do you also have benchmarks that compare Boa to other engines?
  • It looks like you already use a bytecode format internally? How feasible do you think it would be for us to generate bytecode directly from the Biome CST? This way, we could use our own parser (which also supports TypeScript) and avoid another serialization/parsing step between our own pipeline and the interpreter we use.
  • How is module loading handled? I see you already have a ModuleLoader trait, so maybe I've already answered most of my own question :) Anything to be mindful of here?
  • Would you be open to accepting PRs for our use case?
@nekevss
Copy link
Member

nekevss commented Feb 13, 2024

Hi!

That's great to hear about your interest in using Boa!

To answer a few of the questions from above:

  • Conformance wise, there's a decent amount more work to be completed around temporal (but I'm sort of biased there 😆). It may also be worth noting that we're a JS engine and not a full runtime, so there may be some runtime features missing, if those are needed. There's also still more room for improvement around performance and optimization, as we've mostly been focusing on conformance.
  • I'm not entirely sure if there are benchmarks with us against other engines, but we do have benchmarks on our site. EDIT: There is some noise in the benchmark results, and we are looking into ways to improve on it in the future.
  • We would definitely welcome PRs to extend Boa's functionality!

EDIT: Boa is currently on test262.fyi for conformance testing for reference

@jedel1043
Copy link
Member

jedel1043 commented Feb 13, 2024

Glad to hear you're considering using Boa!

Just answering some of your questions in more detail:

  • I'd say our biggest missing features conformance wise would be FinalizationRegistry and Atomic.waitAsync, but everything else should be pretty much in sync with the current spec (excluding Temporal which as @nekevss mentioned is still a WIP, but I don't include it because it's still a stage 3 proposal). Our biggest limitation right now is performance wise, because we have been focusing solely on improving our conformance (make it work, make it right, make it fast... or something like that).
  • I think it should be possible to expose our bytecode compilation machinery as composable methods, but it would require a bit of API design. Otherwise, exposing it as it is would mean having a deep understanding of the internals of our VM, which is not ideal for your use case.
  • ModuleLoader is pretty straightforward to use because we tried to match it as closely to the spec as possible. The only hurdle right now would be using Rust futures to handle asynchronous loading of modules, mainly because the integration of Promises <-> Futures is hard to do right now thanks to the lack of stable coroutines from Rust's side (or any other way to preserve Boa's &mut Context between await points).

If you have any technical questions about the engine, feel free to open a discussion thread in the repo and we'll try to answer ASAP :)

@arendjr
Copy link
Author

arendjr commented Feb 13, 2024

Thanks, that gives me some good starting references! Conformance-wise it seems Boa might be good enough already for us then, and performance I guess we'll have to see :) I'll try if I can make a PoC first with a transpilation step in-between to see how far that gets us.

@arendjr
Copy link
Author

arendjr commented Feb 14, 2024

A first PoC PR is ready: biomejs/biome#1825

@arendjr
Copy link
Author

arendjr commented Feb 14, 2024

Btw, the issue I was referring to with the module loader is the ContextBuilder::module_loader() method. Its signature refused to accept my Rc<SimpleModuleLoader> instance, but in main it’s fixed. I did notice the last release has been a while, is there a roadmap on when the next version is expected?

@jedel1043
Copy link
Member

Our roadmap for this cycle is almost done, we're working on migrating our Temporal implementation, fixing some bugs with our conformance tester and finishing our new webpage. No promises, but expect a release at the end of the month/start of the next month.

@arendjr
Copy link
Author

arendjr commented Feb 14, 2024

Perfect, thanks for your work!

@boa-dev boa-dev locked and limited conversation to collaborators Feb 17, 2024
@jedel1043 jedel1043 converted this issue into discussion #3678 Feb 17, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants