logiguard fork v3: full patch set on verified 8c74db0 tree
Includes prior-session patches (carry forward so the app compiles): - crates/gpui/build.rs: cross-compile manifest fix - crates/gpui/src/platform.rs: PlatformWindow::activate_with_token trait method - crates/gpui/src/window.rs: Window::activate_with_token public API - crates/gpui_linux/src/linux/wayland/window.rs: WaylandWindow::activate_with_token + activate() keyboard-serial fix Plus the focus-serial fix: - serial.rs: SerialKind::KeyboardEnter - client.rs: store wl_keyboard.enter serial; latest_serial_of() Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
77
crates/project_panel/benches/sorting.rs
Normal file
77
crates/project_panel/benches/sorting.rs
Normal file
@@ -0,0 +1,77 @@
|
||||
use criterion::{Criterion, criterion_group, criterion_main};
|
||||
use project::{Entry, EntryKind, GitEntry, ProjectEntryId};
|
||||
use project_panel::par_sort_worktree_entries;
|
||||
use settings::{ProjectPanelSortMode, ProjectPanelSortOrder};
|
||||
use std::sync::Arc;
|
||||
use util::rel_path::RelPath;
|
||||
|
||||
fn load_linux_repo_snapshot() -> Vec<GitEntry> {
|
||||
let file = std::fs::read_to_string(concat!(
|
||||
env!("CARGO_MANIFEST_DIR"),
|
||||
"/benches/linux_repo_snapshot.txt"
|
||||
))
|
||||
.expect("Failed to read file");
|
||||
file.lines()
|
||||
.filter_map(|line| {
|
||||
let kind = match line.chars().next() {
|
||||
Some('f') => EntryKind::File,
|
||||
Some('d') => EntryKind::Dir,
|
||||
_ => return None,
|
||||
};
|
||||
|
||||
let entry = Entry {
|
||||
kind,
|
||||
path: Arc::from(RelPath::unix(&(line.trim_end()[2..])).unwrap()),
|
||||
id: ProjectEntryId::default(),
|
||||
size: 0,
|
||||
inode: 0,
|
||||
mtime: None,
|
||||
canonical_path: None,
|
||||
is_ignored: false,
|
||||
is_always_included: false,
|
||||
is_external: false,
|
||||
is_private: false,
|
||||
is_hidden: false,
|
||||
char_bag: Default::default(),
|
||||
is_fifo: false,
|
||||
};
|
||||
Some(GitEntry {
|
||||
entry,
|
||||
git_summary: Default::default(),
|
||||
})
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
fn criterion_benchmark(c: &mut Criterion) {
|
||||
let snapshot = load_linux_repo_snapshot();
|
||||
|
||||
let modes = [
|
||||
("DirectoriesFirst", ProjectPanelSortMode::DirectoriesFirst),
|
||||
("Mixed", ProjectPanelSortMode::Mixed),
|
||||
("FilesFirst", ProjectPanelSortMode::FilesFirst),
|
||||
];
|
||||
let orders = [
|
||||
("Default", ProjectPanelSortOrder::Default),
|
||||
("Upper", ProjectPanelSortOrder::Upper),
|
||||
("Lower", ProjectPanelSortOrder::Lower),
|
||||
("Unicode", ProjectPanelSortOrder::Unicode),
|
||||
];
|
||||
|
||||
for (mode_name, mode) in &modes {
|
||||
for (order_name, order) in &orders {
|
||||
c.bench_function(
|
||||
&format!("Sort linux worktree snapshot ({mode_name}, {order_name})"),
|
||||
|b| {
|
||||
b.iter_batched(
|
||||
|| snapshot.clone(),
|
||||
|mut snapshot| par_sort_worktree_entries(&mut snapshot, *mode, *order),
|
||||
criterion::BatchSize::LargeInput,
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
criterion_group!(benches, criterion_benchmark);
|
||||
criterion_main!(benches);
|
||||
Reference in New Issue
Block a user