Port of the Python/PyQt6 app: same library database, playlists, hero panel, lyrics, tag editor, MusicBrainz/cover tools, CD ripping, MPRIS and tray. New: right-click 'Set <tag> to "value"' writes the clicked cell's tag into every selected file (with undo). The seek bar now runs off a monotonic position clock so it can't jump back and forth. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
41 lines
1.5 KiB
Rust
41 lines
1.5 KiB
Rust
//! Per-frame CPU cost of the whole UI while a song plays (release build recommended):
|
|
//! `MULBERRY_SCRATCH=… cargo test --release --test bench -- --nocapture`
|
|
|
|
use eframe::egui::vec2;
|
|
use egui_kittest::Harness;
|
|
use mulberry::app::App;
|
|
use std::time::Instant;
|
|
|
|
#[test]
|
|
fn frame_cost_while_playing() {
|
|
let sc = std::path::PathBuf::from(std::env::var("MULBERRY_SCRATCH").expect("set MULBERRY_SCRATCH"));
|
|
std::env::set_var("MULBERRY_TEST", "1");
|
|
std::env::set_var("XDG_DATA_HOME", sc.join("data"));
|
|
std::env::set_var("XDG_CONFIG_HOME", sc.join("config"));
|
|
std::env::set_var("XDG_CACHE_HOME", sc.join("cache"));
|
|
let mut h = Harness::builder().with_size(vec2(1380.0, 860.0)).build_eframe(|cc| App::new(cc, vec![]));
|
|
for _ in 0..40 {
|
|
h.step();
|
|
std::thread::sleep(std::time::Duration::from_millis(30));
|
|
}
|
|
h.state_mut().do_action("pp");
|
|
for _ in 0..30 {
|
|
h.step();
|
|
std::thread::sleep(std::time::Duration::from_millis(30));
|
|
}
|
|
let n = 300;
|
|
let mut total = std::time::Duration::ZERO;
|
|
let mut worst = std::time::Duration::ZERO;
|
|
for _ in 0..n {
|
|
let t = Instant::now();
|
|
h.step();
|
|
let shapes = h.output().shapes.clone();
|
|
let _ = h.ctx.tessellate(shapes, 1.0);
|
|
let d = t.elapsed();
|
|
total += d;
|
|
worst = worst.max(d);
|
|
std::thread::sleep(std::time::Duration::from_millis(33));
|
|
}
|
|
let avg = total / n;
|
|
eprintln!("avg frame {avg:?}, worst {worst:?} => at 30 fps ≈ {:.2}% of one core", avg.as_secs_f64() * 30.0 * 100.0);
|
|
}
|