Skip to content

Commit 9b8075e

Browse files
committed
perf(vm): Remove unnecessary check when calling closures
1 parent a5a2296 commit 9b8075e

File tree

2 files changed

+16
-20
lines changed

2 files changed

+16
-20
lines changed

Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ path = "examples/lisp/main.rs"
145145
[package.metadata.docs.rs]
146146
features = ["docs_rs"]
147147

148-
# [profile.bench]
149-
# debug = 2
150-
#
151-
# [profile.release]
152-
# debug = 2
148+
[profile.bench]
149+
debug = 2
150+
151+
[profile.release]
152+
debug = 2

vm/src/thread.rs

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1815,22 +1815,18 @@ impl<'b> OwnedContext<'b> {
18151815
}) => {
18161816
let instruction_index = *instruction_index;
18171817

1818-
if context.stack.stack().get_frames().len() == 0 {
1819-
return Ok(Some(self)).into();
1820-
} else {
1821-
debug!(
1822-
"Continue with {}\nAt: {}/{}\n{:?}",
1823-
closure.function.name,
1824-
instruction_index,
1825-
closure.function.instructions.len(),
1826-
&context.stack[..]
1827-
);
1818+
debug!(
1819+
"Continue with {}\nAt: {}/{}\n{:?}",
1820+
closure.function.name,
1821+
instruction_index,
1822+
closure.function.instructions.len(),
1823+
&context.stack[..]
1824+
);
18281825

1829-
let closure_context = context.from_state();
1830-
match ready!(closure_context.execute_())? {
1831-
Some(new_context) => context = new_context,
1832-
None => return Ok(None).into(),
1833-
}
1826+
let closure_context = context.from_state();
1827+
match ready!(closure_context.execute_())? {
1828+
Some(new_context) => context = new_context,
1829+
None => return Ok(None).into(),
18341830
}
18351831
}
18361832
};

0 commit comments

Comments
 (0)