-
-
Notifications
You must be signed in to change notification settings - Fork 255
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
Profiling support #743
Profiling support #743
Conversation
crates/rapier3d-urdf/Cargo.toml
Outdated
@@ -21,6 +27,7 @@ anyhow = "1" | |||
bitflags = "2" | |||
# NOTE: we are not using the (more recent) urdf-rs crate because of https://github.com/openrr/urdf-rs/issues/94 | |||
xurdf = "0.2" | |||
profiling = "1.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added the profiling
dependency there but I think I didn´t mark any functions
src_testbed/testbed.rs
Outdated
@@ -1552,6 +1552,7 @@ fn update_testbed( | |||
if state.running == RunMode::Step { | |||
state.running = RunMode::Stop; | |||
} | |||
profiling::finish_frame!(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
profiling::finish_frame!();
belongs here (in user code), as rapier isn't strictly the owner of the loop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking great, thank you! A few remarks:
- Does
#[profiling::function]
generate code or slow down compilation when no backend is specified? If that’s the case, thenprofiling
should be behind a feature. - The flamegraph is expanding vertically a lot with empty space. Can the vertical size be constrained?
- The table is also quite big vertically, it would be nice if it was smaller.
- On the testbed, we should remove from the flamegraph and table anything that isn’t related to rapier (like all the wgpu stuffs).
Let’s keep the rapier counters for now, until I get more familiar with this new profiling tool.
No runtime impact should appear: from their docs :
Concerning compilation time, I didn't notice impact. See attached compiling timings differences from this branch (without profiling enabled) with master: |
I imagine the best solution would be to filter performance information, unfortunately it's complicated to make on egui_puffin: I can imagine a solution by providing an automatic zoom into our relevant time span, by finding Figuring this out is not trivial and it would not support selecting multiple frames. Strictly removing data from wgpu etc doesn't seem supported by As an ideal solution would require potentially controversial PR to I removed some function profiling markers to help with information overload. adapting the egui render of the puffing profiler is not trivial either, so I shoved it into its own window, which is collapsed by default:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
I don’t know when puffin will merge your changes. So I think that in the mean time we move the changes needing the cargo patches behind a feature (#[unstable-puffin-pr-235
) so we can use it locally without blocking our capability to publish the testbed.
Cargo.toml
Outdated
# puffin_egui = { optional = true, path = "../puffin/puffin_egui" } | ||
# puffin = { optional = true, path = "../puffin/puffin" } | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# puffin_egui = { optional = true, path = "../puffin/puffin_egui" } | |
# puffin = { optional = true, path = "../puffin/puffin" } |
@@ -34,9 +34,11 @@ default = ["dim2"] | |||
dim2 = [] | |||
parallel = ["rapier/parallel", "num_cpus"] | |||
other-backends = ["wrapped2d"] | |||
profiling = ["dep:puffin_egui", "profiling/profile-with-puffin"] | |||
unstable-puffin-pr-235 = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add comment to explain the patch needed
This PR uses https://crates.io/crates/profiling so we can choose any supported profiling options. This is also helpful for users to get an understanding of performances.
using tracy on all_examples3 (
cargo run --bin all_examples3 --features profiling/profile-with-tracy
)Should we remove
counters
from rapier ? I imagine it would be great to be able to output the same kind of csv we're doing currently, but using this profiling option.