Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf(translator): increase performance #204

Merged
merged 1 commit into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ rhai = ["dep:rhai"]
rhai-wasm = ["rhai", "rhai/wasm-bindgen"]

[dependencies]
rhai = { version = "1.17.1", optional = true, features = ["only_i32", "f32_float", "no_custom_syntax"] }
rhai = { version = "1.17.1", optional = true, features = ["only_i32", "no_float", "no_closure", "unchecked", "no_position", "no_custom_syntax"] }
indexmap = { version = "2.2.5", features = ["serde"] }
serde = { version = "1.0.197", features = ["derive"] }
toml = { version = "0.8.10", features = ["preserve_order"] }
Expand Down
6 changes: 1 addition & 5 deletions config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,11 +378,7 @@ impl Config {
fs: &impl FileSystem,
) -> Result<IndexMap<String, AST>> {
let empty = IndexMap::default();
let mut engine = Engine::new();

// allow nesting up to 50 layers of expressions/statements
// at global level, but only 10 inside function
engine.set_max_expr_depths(25, 25);
let engine = Engine::new();

self.translators
.as_ref()
Expand Down
2 changes: 1 addition & 1 deletion engine/translator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ strsim = ["dep:strsim"]
serde = ["indexmap/serde", "rhai/serde"]

[dependencies]
rhai = { version = "1.17.1", optional = true, features = ["only_i32", "f32_float", "no_custom_syntax"] }
rhai = { version = "1.17.1", optional = true, features = ["only_i32", "no_float", "no_closure", "unchecked", "no_position", "no_custom_syntax"] }
indexmap = { version = "2.2.5" }
strsim = { version = "0.11.0", optional = true }

Expand Down
2 changes: 0 additions & 2 deletions engine/translator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,6 @@ impl Translator {
/// }
/// "#;
/// let mut engine = Engine::new();
/// // confer: https://rhai.rs/book/safety/max-stmt-depth.html
/// engine.set_max_expr_depths(25, 25);
/// let date_translator = engine.compile(date_translator).unwrap();
///
/// // We build the translator.
Expand Down
Loading