4 ms·
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?
by satvikpendem 2y 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?
- MarceColl 2y agoNot 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.
- xnacly 2y agoAccording 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 https://github.com/xNaCly/Sophia
- diggan 2y agoAs 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"?
- xnacly 2y agoIt 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
- wffurr 2y agoMillisecond timings are only meaningful on a specific hardware target.
- ComputerGuru 2y agoWriting scripts in rust is as easy as copying and pasting this shebang: https://neosmart.net/blog/self-compiling-rust-code/ https://neosmart.net/blog/self-compiling-rust-code/ But that doesn’t make it embeddable, of course.
- yencabulator 2y agoNightly doesn't need 3rd party tools at all: https://doc.rust-lang.org/cargo/reference/unstable.html#script https://doc.rust-lang.org/cargo/reference/unstable.html#scri...
- ComputerGuru 2y agoTechnically my solution didn’t either. Does the nightly solution cache the output?