Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Skip downcast_ref checks in invoke when tracing is disabled
Early return in PyCallable::invoke() when use_tracing is false,
avoiding two downcast_ref type checks on every function call.
  • Loading branch information
youknowone committed Mar 1, 2026
commit 6a9be9f780d5759f4a8c56df5576c5cb5c489108
3 changes: 3 additions & 0 deletions crates/vm/src/protocol/callable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ impl<'a> PyCallable<'a> {

pub fn invoke(&self, args: impl IntoFuncArgs, vm: &VirtualMachine) -> PyResult {
let args = args.into_args(vm);
if !vm.use_tracing.get() {
return (self.call)(self.obj, args, vm);
}
// Python functions get 'call'/'return' events from with_frame().
// Bound methods delegate to the inner callable, which fires its own events.
// All other callables (built-in functions, etc.) get 'c_call'/'c_return'/'c_exception'.
Expand Down