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: improve debug_traceBlock performance #11979

Merged

Conversation

lakshya-sky
Copy link
Contributor

@lakshya-sky lakshya-sky commented Oct 22, 2024

Fixes #11066

Instead of creating TracingInspector on each call just use the optionally passed inspector and instead of cloning the whole GethDebugTracingOptions just clone the parts of it when necessary.

One caveat of this approach is that if inspector was initialized with CallConfig and passed for PreStateTracer then this would not work, so caller of the trace_transaction needs to make sure that correct inspector is passed for the tracing.

Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool, left some suggestions

crates/rpc/rpc/src/debug.rs Outdated Show resolved Hide resolved
crates/rpc/rpc/src/debug.rs Outdated Show resolved Hide resolved
crates/rpc/rpc/src/debug.rs Outdated Show resolved Hide resolved
crates/rpc/rpc/src/debug.rs Outdated Show resolved Hide resolved
crates/rpc/rpc/src/debug.rs Outdated Show resolved Hide resolved
Comment on lines 736 to 741
let call_config = tracer_config
.clone()
.into_call_config()
.map_err(|_| EthApiError::InvalidTracerConfig)?;

let mut inspector = TracingInspector::new(
let mut inspector = shared_inspector.get_or_insert(TracingInspector::new(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is also slightly redundant work if the inspector is present, we have this a few time and we can definitely solve this more elegantly

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah turns out we can't easily do this because we need the config

@onbjerg onbjerg changed the title Improve debug_traceBlock performance perf: improve debug_traceBlock performance Oct 23, 2024
@onbjerg onbjerg added C-perf A change motivated by improving speed, memory usage or disk footprint A-rpc Related to the RPC implementation labels Oct 23, 2024
Copy link
Member

@emhane emhane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@lakshya-sky lakshya-sky force-pushed the improve-debug-traceBlock-performance branch from ca302df to ebbc8e1 Compare October 24, 2024 15:41
Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, ty

Comment on lines 736 to 741
let call_config = tracer_config
.clone()
.into_call_config()
.map_err(|_| EthApiError::InvalidTracerConfig)?;

let mut inspector = TracingInspector::new(
let mut inspector = shared_inspector.get_or_insert(TracingInspector::new(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah turns out we can't easily do this because we need the config

@mattsse mattsse added this pull request to the merge queue Oct 26, 2024
Merged via the queue into paradigmxyz:main with commit ac329bf Oct 26, 2024
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rpc Related to the RPC implementation C-perf A change motivated by improving speed, memory usage or disk footprint
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve debug_traceBlock performance
4 participants