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

Don't merge scopes that have different data #102

Merged
merged 3 commits into from
Oct 19, 2022
Merged

Conversation

repi
Copy link
Contributor

@repi repi commented Oct 18, 2022

Previously we would merge all scopes that have the same id, but if you have multiple scopes after each that have same id but different dynamic data field they would be merged together and we wouldn't display the data field.

This is something we ran into in our codebase that made it harder to see why a certain heavy operation was happening as we were missing the context for it. Which we did specify but was merged together and not shown here as merging scopes is on by default (and is a general good idea).

Adds a simple visual test for in the imgui and egui clients.

Resolves: #73

Example

This is how it looks like now:

image

from the following code:

// test to verify these spikes timers are not merged together as they have different data
for (name, ms) in [("First".to_string(), 20), ("Second".to_string(), 15)] {
    puffin::profile_scope!("Spike", name);
    std::thread::sleep(std::time::Duration::from_millis(ms))
}
// these are however fine to merge together as data is the same
for (_name, ms) in [("First".to_string(), 20), ("Second".to_string(), 15)] {
    puffin::profile_scope!("Spike");
    std::thread::sleep(std::time::Duration::from_millis(ms))
}

Before this PR this would have been a single "4x Spike"

Previously we would merge all scopes that have the same `id`, but if you have multiple scopes after each that have same `id` but different dynamic `data` field they would be merged together and we wouldn't display the `data` field.

This is something we ran into in our codebase that made it harder to see why a certain heavy operation was happening as we were missing the context for it. Which we did specify but was merged together and not shown here as merging scopes is on by default (and is a general good idea).

Adds a simple visual test for in the imgui and e gui clients.
@repi repi requested review from emilk and VZout as code owners October 18, 2022 15:09
Copy link
Contributor

@bnjbvr bnjbvr left a comment

Choose a reason for hiding this comment

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

The code makes sense 👍 Thanks for fixing that!

puffin/src/merge.rs Outdated Show resolved Hide resolved
@repi repi removed the request for review from VZout October 18, 2022 15:59
@repi
Copy link
Contributor Author

repi commented Oct 18, 2022

removing @VZout as @TimonPost is going to take over as CODEOWNER on the Embark side

Copy link
Collaborator

@emilk emilk left a comment

Choose a reason for hiding this comment

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

LGTM!

@emilk
Copy link
Collaborator

emilk commented Oct 19, 2022

Maybe add a line in the appropriate changelogs?

@repi repi merged commit 1efc17b into main Oct 19, 2022
@repi repi deleted the handle-merging-with-data branch October 19, 2022 14:11
@repi
Copy link
Contributor Author

repi commented Oct 19, 2022

@TimonPost could do a new puffin release with this & latest?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Don't merge scopes that have non-matching dynamic data
4 participants