perf: add fused callback info parts#1983
Open
bartlomieju wants to merge 1 commit into
Open
Conversation
littledivy
approved these changes
May 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
FunctionCallbackInfo::get_parts()as a single callback-entry shim that returns the isolate pointer, return value, callback data, and argument length together.This lets raw callbacks avoid separate C++ FFI calls for the common callback prologue:
CallbackScope::new(info)/ isolate lookupReturnValue::from_function_callback_info(info)FunctionCallbackArguments::from_function_callback_info(info)for callback data and argument lengthThe new
FunctionCallbackInfoPartscan be passed directly toCallbackScope, andFunctionCallbackArguments::from_function_callback_info_parts(info, &parts)reuses the already-loaded callback data and length.Deno usage
The main Deno consumer should be the generated slow op callback prologue in:
libs/ops/op2/dispatch_slow.rs:with_scope,with_retval, andwith_fn_argscurrently generate separate callback-info reads for slow ops.libs/ops/op2/dispatch_async.rs: async slow op generation reuses those same helpers and can benefit from the same callback-entry snapshot.A smaller direct use is:
libs/core/ops_metrics.rs:slow_metrics_dispatchcurrently constructsFunctionCallbackArgumentsonly to read callback data and recoverOpCtx; it can useinfo.get_parts().datadirectly.There are also scattered core callbacks, for example
libs/core/error.rsandlibs/core/runtime/bindings.rs, but the op2 generator is the valuable centralized follow-up because it affects many generated slow callback paths.Validation
cargo fmtcargo checkcargo check --benchesI also tried
cargo test --test test_api function_callback_info_parts -- --nocapture; it compiled Rust code but failed at the native link step in my local tree because the existing native archive is missing_v8__FunctionCallbackInfo__GetPartsplus pre-existing missing symbols_v8__Object__SetLazyDataPropertyand_v8__String__Concat.