Use fast operators mode in rhai-run.

This commit is contained in:
Stephen Chung 2022-09-03 15:31:29 +08:00
parent 06dea067b7
commit 2de4325d7e
2 changed files with 3 additions and 0 deletions

View File

@ -50,6 +50,8 @@ fn main() {
// Initialize scripting engine
let mut engine = Engine::new();
engine.set_fast_operators(true);
#[cfg(not(feature = "no_optimize"))]
engine.set_optimization_level(rhai::OptimizationLevel::Simple);

View File

@ -228,6 +228,7 @@ impl Engine {
..
} = expr;
// Short-circuit operator call if under Fast Operators mode
if *std_ops && self.fast_operators() {
let mut lhs = self
.get_arg_value(scope, global, caches, lib, this_ptr, &args[0], level)?