3 ms·
It isn't, v8 will have anywhere between 2-1000x performance depending on the exact code it's jitting. Boa absolutely destroys v8 here though: use boa_engin
by baq 1y ago
It isn't, v8 will have anywhere between 2-1000x performance depending on the exact code it's jitting. Boa absolutely destroys v8 here though:
use boa_engine::{Context, Source, JsResult};
fn main() -> JsResult<()> {
let js_code = r#"
let two = 1 + 1;
let definitely_not_four = two + "2";
definitely_not_four
"#;
// Instantiate the execution context
let mut context = Context::default();
// Parse the source code
let result = context.eval(Source::from_bytes(js_code))?;
println!("{}", result.display());
Ok(())
}
- echelon 1y agoOh my god, that's so easy to embed. I have to check this out. This is awesome. You literally just sold me on it.
- IshKebab 1y ago> anywhere between 2-1000x performance depending on the exact code it's jitting That is useful information! Benchmarks can show you this useful information.
- nekevss 1y agoHuh, I just noticed thanks to this that the comment needs to be updated in the example lol it should probably say "Parse and evaluate the source code".