From 1e6da2e93d0af1deb96abdbe5d7e6b1eff95cc9c Mon Sep 17 00:00:00 2001 From: Leonard Hecker Date: Fri, 28 Mar 2025 22:53:32 +0100 Subject: [PATCH] Extend and improve ucd benchmark --- benches/lib.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/benches/lib.rs b/benches/lib.rs index c167525..831902f 100644 --- a/benches/lib.rs +++ b/benches/lib.rs @@ -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(); }