-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Optimize DebugNode flatten_to #7386
Comments
May I know how do you generate the image under Additional context |
Hi @mattsse . |
yeah, I think it should be similar to |
|
I will give it a try then! |
Would like to give it a try as well. Does this change looks ok? pub fn flatten_to(&self, entry: usize, out: &mut Vec<DebugNodeFlat>) {
let mut stack = VecDeque::new();
stack.push_back(entry);
while let Some(entry) = stack.pop_back() {
let node = &self.arena[entry];
if !node.steps.is_empty() {
out.push(node.flat());
}
for child in node.children.iter().rev() {
stack.push_back(*child);
}
}
} Also, what needs to be done to test it? |
Sure, no problem. Let me know if I can still help with something |
@mattsse What command should generate the profiler image from additional context? As suggested by @DaniPopes how should we work on this function and try to get rid this
|
IMO we can't get rid of clones since we are passing DebugArena by ref, but somebody can correct me on this. |
You're right, we have to pass by reference due to the nested data structure. I don't think this is worth it. |
Component
Forge
Describe the feature you would like
ref #7382
This currently does a bunch of expensive clones:
foundry/crates/debugger/src/tui/builder.rs
Lines 40 to 45 in b2f9346
foundry/crates/evm/core/src/debug.rs
Lines 74 to 87 in b2f9346
since we're consuming the type, we can get rid of the clones by rewriting this with a stack approach
Additional context
The text was updated successfully, but these errors were encountered: