News for hackers. Stuff that matters.
Re:Boa: an experimental Javascript lexer, parser and compile... by migueloller on Friday October 02, 2020 @11:51AM (#24663869)
It's very interesting to see how their benchmarks [1] progress over time. I would love to see a comparison with the alternatives. Perhaps that could show some of the benefits of writing this in Rust.

For another JavaScript parser, but written in TypeScript, check out Seafox [2]. It's also self-hosted [3], which I always enjoy seeing.

[1] https://boa-dev.github.io/boa/dev/bench/

[2] https://github.com/KFlash/seafox

[3] https://en.wikipedia.org/wiki/Self-hosting_(compilers)

Re:Boa: an experimental Javascript lexer, parser and compile... by brian_herman__ on Friday October 02, 2020 @02:59PM (#24665893)
Here is another one. Made by the profilic Fabrice Bellard.

"QuickJS is a small and embeddable Javascript engine. It supports the ES2020 specification including modules, asynchronous generators, proxies and BigInt."

https://bellard.org/quickjs/

Re:Boa: an experimental Javascript lexer, parser and compile... by gameswithgo on Friday October 02, 2020 @03:31PM (#24666238)
Self hosting is interesting, but often times I wish that fundamental tools like compilers were not self hosted when the language in question is a high level one with runtime performance limitations. I'd rather have them be as fast as possible.
Re:Boa: an experimental Javascript lexer, parser and compile... by capitol_ on Friday October 02, 2020 @04:38PM (#24666779)
It also complicates the bootstrapping process, sometimes significantly.

I understand that it's important to eat your own dog food, in order to experience the pain points yourself. But sometimes people think of self hosting as a symbol of something (pride maybe), and that's the wrong way to approach a programming problem in my opinion.

Re:Boa: an experimental Javascript lexer, parser and compile... by wtetzner on Friday October 02, 2020 @04:56PM (#24666949)
In practice, I suspect it's less about pride, and more about practical issues. Bootstrapping means you only need to deal with one language ecosystem, instead of two. And, presumably, the author of the compiler would prefer to write code in their language over some other one.
Re:Boa: an experimental Javascript lexer, parser and compile... by wtetzner on Friday October 02, 2020 @04:53PM (#24666918)
I think it depends. Writing a compiler in a low-level language won't necessarily result in better performance. It can, if you put in enough performance work, of course.

But if you want to keep the code simpler, a higher-level language could potentially give better performance, simply because it's easier to share data structures, avoid copying, etc. Additionally, things like immutable persistent maps are a great fit for environments in a compiler, and they are much easier to implement in a language with garbage collection.

That said, obviously some high-level languages are still going to be too slow without also putting in a lot of work. I think there's a sweet spot with languages that compile to reasonably fast machine code but are also garbage collected. Languages like OCaml, Go, Haskell. Though I personally wouldn't use Go, but that's for reasons other than performance.