mirror of
https://github.com/microsoft/edit.git
synced 2025-07-03 22:43:22 +00:00
Extend and improve ucd benchmark
This commit is contained in:
parent
ed78bc917f
commit
1e6da2e93d
1 changed files with 15 additions and 1 deletions
|
@ -4,7 +4,12 @@ use edit::ucd::MeasurementConfig;
|
|||
use std::hint::black_box;
|
||||
|
||||
fn bench(c: &mut Criterion) {
|
||||
let reference = "The quick brown fox jumps over the lazy dog\u{1F469}\u{1F3FB}\u{200D}\u{2764}\u{FE0F}\u{200D}\u{1F48B}\u{200D}\u{1F468}\u{1F3FB}\n";
|
||||
let reference = concat!(
|
||||
"In the quiet twilight, dreams unfold, soft whispers of a story untold.\n",
|
||||
"月明かりが静かに照らし出し、夢を見る心の奥で詩が静かに囁かれる\n",
|
||||
"Stars collide in the early light of hope, echoing the silent call of the night.\n",
|
||||
"夜の静寂、希望と孤独が混ざり合うその中で詩が永遠に続く\n",
|
||||
);
|
||||
let buffer = reference.repeat(10);
|
||||
let bytes = buffer.as_bytes();
|
||||
|
||||
|
@ -13,6 +18,15 @@ fn bench(c: &mut Criterion) {
|
|||
group.bench_function("MeasurementConfig::goto_logical", |b| {
|
||||
b.iter(|| black_box(MeasurementConfig::new(&bytes).goto_logical(Point::MAX)))
|
||||
});
|
||||
group.bench_function("MeasurementConfig::goto_logical with word wrap", |b| {
|
||||
b.iter(|| {
|
||||
black_box(
|
||||
MeasurementConfig::new(&bytes)
|
||||
.with_word_wrap_column(50)
|
||||
.goto_logical(Point::MAX),
|
||||
)
|
||||
})
|
||||
});
|
||||
group.finish();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue