diff --git a/src/bin/rhai-run.rs b/src/bin/rhai-run.rs index e87e99b4..e44a3b7f 100644 --- a/src/bin/rhai-run.rs +++ b/src/bin/rhai-run.rs @@ -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); diff --git a/src/eval/expr.rs b/src/eval/expr.rs index 661534a7..48f870a4 100644 --- a/src/eval/expr.rs +++ b/src/eval/expr.rs @@ -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)?