switch to profiling crates

This switches to the profiling crate for compatible
profiling between rust libraries.

To enable:

$ cargo build --release --features puffin

Feel free to experiment with other profiling backends
as well! Would be great to get tracy working.
This commit is contained in:
William Casarin
2025-03-23 10:43:49 -07:00
parent 7b9e6f180c
commit 54deb2dd88
20 changed files with 46 additions and 80 deletions

View File

@@ -80,6 +80,7 @@ impl<'cache, 'url> ProfilePic<'cache, 'url> {
}
}
#[profiling::function]
fn render_pfp(
ui: &mut egui::Ui,
img_cache: &mut Images,
@@ -87,9 +88,6 @@ fn render_pfp(
ui_size: f32,
border: Option<Stroke>,
) -> egui::Response {
#[cfg(feature = "profiling")]
puffin::profile_function!();
// We will want to downsample these so it's not blurry on hi res displays
let img_size = 128u32;
@@ -116,15 +114,13 @@ fn render_pfp(
)
}
#[profiling::function]
fn pfp_image(
ui: &mut egui::Ui,
img: &TextureHandle,
size: f32,
border: Option<Stroke>,
) -> egui::Response {
#[cfg(feature = "profiling")]
puffin::profile_function!();
let (rect, response) = ui.allocate_at_least(vec2(size, size), Sense::hover());
if let Some(stroke) = border {
draw_bg_border(ui, rect.center(), size, stroke);