reorganize module
This commit is contained in:
25
_archive/rhai_engine/rhaibook/engine/optimize/disable.md
Normal file
25
_archive/rhai_engine/rhaibook/engine/optimize/disable.md
Normal file
@@ -0,0 +1,25 @@
|
||||
Turn Off Script Optimizations
|
||||
=============================
|
||||
|
||||
{{#include ../../links.md}}
|
||||
|
||||
When scripts:
|
||||
|
||||
* are known to be run only _once_ and then thrown away,
|
||||
|
||||
* are known to contain no dead code,
|
||||
|
||||
* do not use constants in calculations
|
||||
|
||||
the optimization pass may be a waste of time and resources.
|
||||
|
||||
In that case, turn optimization off by setting the optimization level to [`OptimizationLevel::None`].
|
||||
|
||||
```rust
|
||||
let engine = rhai::Engine::new();
|
||||
|
||||
// Turn off the optimizer
|
||||
engine.set_optimization_level(rhai::OptimizationLevel::None);
|
||||
```
|
||||
|
||||
Alternatively, disable optimizations via the [`no_optimize`] feature.
|
Reference in New Issue
Block a user