Comment by satvikpendem
1 year ago
When I last read about Rhai it was apparently very slow such that it was simply faster and more ergonomic writing scripts in Rust itself, has that changed?
1 year ago
When I last read about Rhai it was apparently very slow such that it was simply faster and more ergonomic writing scripts in Rust itself, has that changed?
According to the documentation it evaluates by walking the ast, so yes, this is considered very slow. The readme also mentions 1 million loop iterations in 0.14s (140ms). Even my unoptimised naive lips like language [1] (also implemented via a ast walker) does the same in 28.67ms - so yes id consider this pretty slow.
[1]: https://github.com/xNaCly/Sophia
As someone who is also implementing a naive "walk the AST" evaluator for lisp, what would be considered OK/fast/not-slow in the case for 1 million loop iterations? Would ~30ms be considered fast or "not-slow"?
It just mentions a loop, so id say for a loop without any content, it should be less than 50ms, but as the other commentor said, it depends on your hardware and a better measurement is to compare relatively
Millisecond timings are only meaningful on a specific hardware target.
Not sure when you read this, but I can tell you that two years ago it was VERY slow. I used it for a game and I had to redo it in lua some months later because it was a big bottleneck. I don't have more up to date information.
Writing scripts in rust is as easy as copying and pasting this shebang: https://neosmart.net/blog/self-compiling-rust-code/
But that doesn’t make it embeddable, of course.
Nightly doesn't need 3rd party tools at all: https://doc.rust-lang.org/cargo/reference/unstable.html#scri...
Technically my solution didn’t either. Does the nightly solution cache the output?