Boa: Why does this project exist?

Created on 11 Oct 2019  路  12Comments  路  Source: boa-dev/boa

I'm genuinely curious.

  • Is this project intended to compete with V8?

    • I'm assuming the memory-safe guaruntees and speed of Rust are the motivating factors here?

    • Are there any other benefits to this project over V8?

    • How about threading?

  • Are there any plans to one day integrate with Node.js and/or Deno?
  • Are there any plans to support TypeScript syntax at some point?

Just started watching the video and got some of the answers above. Looks like "control" and "safety" of rust were the main two reasons this project was created.

Still, perhaps some design goals would be helpful in this repo's wiki?

question

Most helpful comment

Hey I will try to answer this properly at some point.

@jedmao garbage collection has to be used, it鈥檚 unavoidable, variables in JavaScript can live after their function scope. This is why every value needs to be wrapped in a GC. Cloning a GCd value only clones the pointer not the value itself so it鈥檚 super lightweight. There is escape analysis (https://en.m.wikipedia.org/wiki/Escape_analysis) but we鈥檙e not at that point yet.

Does this mean it鈥檚 less valuable using Rust? Absolutely not, there are still loads of advantages. Concurrency and parallelism is easier with parsing and execution. Type safety is something that I have help from the compiler with, no header files and fast run time.

Why did I build this? I wanted to learn how JS compilers work, what sort of optimisations they make, and to see if we can add some competition to browser grade interpreters out there.

All 12 comments

I was about to ask the same question.

I appreciate this, but I'm not sure what is end-goal here. Is it supposed to be faster than V8? Is it supposed to take advantage of typescript types to be even faster?

If that's just a clone of V8 - how is it going to be trying to be an alternative for it?

I also noticed during the presentation that garbage collection is being used in Rust, wondering if that kind of reduces the value of using Rust in the first place?

Hey I will try to answer this properly at some point.

@jedmao garbage collection has to be used, it鈥檚 unavoidable, variables in JavaScript can live after their function scope. This is why every value needs to be wrapped in a GC. Cloning a GCd value only clones the pointer not the value itself so it鈥檚 super lightweight. There is escape analysis (https://en.m.wikipedia.org/wiki/Escape_analysis) but we鈥檙e not at that point yet.

Does this mean it鈥檚 less valuable using Rust? Absolutely not, there are still loads of advantages. Concurrency and parallelism is easier with parsing and execution. Type safety is something that I have help from the compiler with, no header files and fast run time.

Why did I build this? I wanted to learn how JS compilers work, what sort of optimisations they make, and to see if we can add some competition to browser grade interpreters out there.

I love this answer and I look forward to seeing you answer more of it "properly at some point."

I hope to get some sort of blog posts working for Boa and i can answer it there, i was originally doing this on my own site, i haven't decided whether to continue doing that or move it do here.

I suppose it doesn鈥檛 matter, so long as you link to relevant documentation from this repo.

Sorry to step in here. I just wanted to give one reason why I think this project is useful for me, and that might be the case for others too. I am working on a project that needs to support JS as extension language. We created a simple WASM sandbox using wasmer as library so we can run untrusted code. I'm planning on using Boa inside the WASM sandbox to enable support JS code from our users.

@rafaelcaricio I have one scenario like this for some r&d work. So a hulk smash +1 on the WASM concern, and how naturally Rust does WASM.

In addition, I have a live system that a team of C# developers work on. We're currently using ChakraCore because it is built to be embedded (it has a real C API, never mind one that's even documented). V8 is not, not by literal moonshot. V8 is built for Chrome, and Chrome alone. Some incredibly talented developers wrangled it otherwise. I'd build a C V8 wrapper for this team, but I really don't have the willpower to learn yet another C build system that is probably horrible on Windows (I'd love to switch to Linux, but devs are Windows). Rust just works. Look at the build instructions (and time!) for V8, then clone this repo and: cargo build. That's why.

I stumbled across this project today, and I want to add that I'd like to see a complete JavaScript engine that's still lightweight and reasonably secure. JavaScript is very much overused, and current implementations seem to eat as much RAM as is available to them. I have 32GB of RAM in my computer, so I don't run out of memory very often, but I almost never hibernate my computer, because it's a slow process, even with an SSD. So maybe this project could help make 4GB of RAM enough again.

Thanks @NobodyIII thats useful to hear

Not going into much detail, this is perfect as an embedded engine to run action snippets. (i.e a rule engine)

Hint: Just try embedding V8 into anything

I believe the question has been answered, but feel free to continue the discussion!

Was this page helpful?
0 / 5 - 0 ratings