Stream: general

Topic: Is Javy running a quickjs in wasm?


view this post on Zulip Hoping White (Aug 26 2024 at 10:44):

I am curious how Javy is implemented and the performance compared with rust wasm.

view this post on Zulip Ramon Klass (Aug 26 2024 at 10:58):

yes javy is just rust wasm + rquickjs + wizer, I don't know of any direct comparisons of performance when comparing a pure rust implementation with a js implementation with javy, and that would also highly depend on the code you are benchmarking

view this post on Zulip Joel Dice (Aug 26 2024 at 13:36):

@Hoping White Whenever anyone asks about QuickJS performance (or the performance of JS interpreters in general), I point them to https://bellard.org/quickjs/bench.html. It doesn't address your question specifically, and none of the results listed there use Wasm as the target, but it will give you a general idea of what to expect.

Specifically, I would expect numbers in the V8 (JIT) column to be comparable to Rust-on-Wasm. So, for CPU-bound workloads, you could expect a roughly 50x performance difference between QuickJS and Rust -- sometimes more, sometimes less. It varies a lot, though, so you'll want to do your own benchmarking with your specific workload(s) if you need a precise answer.

view this post on Zulip Milan (Aug 26 2024 at 21:49):

Porffor is an experimental AoT JS compiler that's targeting the order of AoT/JIT perf. Still very nascent and not production ready but a cool idea: https://porffor.dev/

view this post on Zulip Chris Fallin (Aug 26 2024 at 21:54):

There is also AOT compilation using SpiderMonkey that I've developed over the past 1.5 years -- available in StarlingMonkey now but please treat as experimental; going to make some blog posts about it soon too

view this post on Zulip Chris Fallin (Aug 26 2024 at 21:54):

(porffor is a really admirable project; they're at just under 40% language compat; JS-AOT / weval on SpiderMonkey passes the whole language test suite, with the tradeoff that its results are a bit slower than a from-scratch AOT compiler could achieve)

view this post on Zulip Hoping White (Aug 26 2024 at 22:45):

I am using wasmtime on android and wasmi on ios as a script engine in Unity game development. I am trying to find some way to execute JavaScript as webassembly. Then I found Javy, but if Javy is simulated using quickjs, I don't think it can be used in production. Porffor is interesting, I will keep an eye on it now. Thanks for all the replys

view this post on Zulip Ralph (Aug 29 2024 at 07:46):

StarlingMonkey is definitely going to be used in production.

view this post on Zulip Jeff Charles (Aug 29 2024 at 14:57):

The performance difference for Javy vs Rust vs alternative approaches for running JavaScript on Wasm are going to depend on your workload and I would encourage you to take benchmarks with your workloads. FWIW, we use Javy in production.

view this post on Zulip Chris Fallin (Aug 29 2024 at 15:51):

StarlingMonkey is definitely going to be used in production.

Is already, in fact!

view this post on Zulip Ralph (Aug 29 2024 at 16:14):

in more than one professional corporation servicing many customers and users

view this post on Zulip Ralph (Aug 29 2024 at 16:14):

:-P

view this post on Zulip Ralph (Aug 29 2024 at 16:21):

Jeff Charles said:

The performance difference for Javy vs Rust vs alternative approaches for running JavaScript on Wasm are going to depend on your workload and I would encourage you to take benchmarks with your workloads. FWIW, we use Javy in production.

THIS MANY TIMES THIS. These are both great tools and you should choose the one you want. My comment is meant only as a way of answering the "I don't think it can be used in production" question. Jeff is also correct: Javy is used in production now in several places as well. StarlingMonkey also is and will be.

view this post on Zulip Joel Dice (Aug 29 2024 at 16:22):

We've been using both Javy and StarlingMonkey with great success. Performance has not been an issue in practice except in very specific cases.

view this post on Zulip Joel Dice (Aug 29 2024 at 16:23):

And thanks to component composition, you can always use both JS and Rust if desired, potentially favoring the latter for number crunching.

view this post on Zulip Ralph (Aug 29 2024 at 16:24):

nice touch, that, Joel


Last updated: Dec 23 2024 at 13:07 UTC