diff options
| author | Ruben Beltran del Rio <jj@r.bdr.sh> | 2025-12-16 11:09:49 +0100 |
|---|---|---|
| committer | Ruben Beltran del Rio <jj@r.bdr.sh> | 2025-12-16 11:15:32 +0100 |
| commit | 6deeee3848e291dee61e239f104dc29bb26f4608 (patch) | |
| tree | e97308fc347e2abef2272942a7e5d71e56ac0469 /benches | |
| parent | f08648e4b5a9f7855a2ed9068a386e2f3c596322 (diff) | |
Benchmark with example, and raw rendering
Diffstat (limited to 'benches')
| -rw-r--r-- | benches/example.wmap | 122 | ||||
| -rw-r--r-- | benches/rendering.rs | 21 |
2 files changed, 132 insertions, 11 deletions
diff --git a/benches/example.wmap b/benches/example.wmap new file mode 100644 index 0000000..a238ab1 --- /dev/null +++ b/benches/example.wmap @@ -0,0 +1,122 @@ +Anchor (40, 0) +Tinker (4,30) [x] +Tailor (7.03, 49.21) [Square] +Soldier (28, 15) [Triangle] +AMnchor (28.22, 45.27) +Tonker (67.3, 4.4) [X] +Tailor1 (1,1) [Square] +Tailor2 (10,1) [Square] +Tailor3 (1,10) [Square] +Tailor4 (20,1) [Square] +Tailor5 (1,20) [Square] +Tailor7 (20,10) [Square] +Tailor8 (9.36, 16.97) [Square] +Tailor777(30,10) [Square] +Tailor10 (18.77, 26.25) [Square] +Tailor11 (10,10) [Square] +Tailor12 (30,20) +Tailor13 (31.10, 28.89) +Tailor14 (13.44, 21.48) [Square] +Tailor19 (45, 2) [triangle] +B (50, 50) +Hellele + +TailorX (20, 50) [Square] + +Hello World (90, 20) [x] + +Anchor -> Soldier… this is changing. +Anchor -> A +Masdlajksd -- Tailor13 + +Mabanchorn -- Anchornalsdjalks + +A +--B + +X (58.52, 27.07) + +Tailor11--Tailor12 +Tailor12--Tailor13 +Tailor777--Tailor8 +Tailor777--Tailor7 +Tailor777--Tailor6 +Tailor7-Tailor6 + +Tinker -- Tailor +Soldier -- Tinker + +[Evolution] Tinker +20 +[Inertia] Soldier + +[i] 15 +[ii] 35 +[iii] 80 + +this is kind of ok … a little bit better to be honest. (69.76, 89.84) + +OK. + +This map so far is fst. asdasd asda + +Holy shit, this is still indeed fast. But everything flashes as I type! This is now happening so fast + +Hello my old friend. + +OK so this map should eventually start getting slow too! + +let’s see how long after.asd asda sda + +asda sdasdasd asdasdasdasdasdasd +OK… Well we are typing. asd as asd as dasd a asdasda sdasd asd + + asd asd asd asdasd asdasd +Alright, the whole text is still fa asdlashing. Wow. This is pretty bad. +aas dasd adsa sd a asd asd asdjlkasjd laksdjasd basldjas!!! + +we have deleted this (20, 40) [triangle] + +a(12, 12) +Time to see if we get the same performance loss as withthis the other one. Well I will continue. Hello this is me. and i’m +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + +b(75,75) +c(9, 90) + +a -- b +b -- c + +d (45, 88) + +c -- d +d -- a +d -- b + +q (90, 60) +b -- q +q -- a +q -- c + +[Evolution] c +20 +[Evolution] d +10 +[Evolution] a -20 +[Evolution] q +5 + +m(50, 60) +n (65, 65) +o (45, 63) + +m -- o +o -- n +n -- m +o -- c +n -- q +m -- d + +testasd asdas +test2asdasa asdasd asd + +[Note] (5, 35) Notes also influence the placement of\n labels. + +[Group] Tailor2, Tailor7, Tailor11, Tailor12, Tailor10, Anchor, Tinker +[Group] Tailor3, Tailor5, Tailor14pr
\ No newline at end of file diff --git a/benches/rendering.rs b/benches/rendering.rs index 549ad21..51e1b13 100644 --- a/benches/rendering.rs +++ b/benches/rendering.rs @@ -1,23 +1,22 @@ use criterion::{black_box, criterion_group, criterion_main, Criterion}; use std::fs; -use wmap_renderer::{render_to_png, Configuration, StageType}; +use wmap_renderer::{render_to_surface, Configuration, StageType}; fn benchmark_rendering(c: &mut Criterion) { - // Read the huge.wmap file for realistic benchmarking - let source = fs::read_to_string("benches/huge.wmap").expect("Failed to read benches/huge.wmap"); - let map = wmap_parser::parse(&source); let config = Configuration::default(); - c.bench_function("render huge map", |b| { - b.iter(|| render_to_png(black_box(&map), StageType::default(), &config)) + let example_source = fs::read_to_string("benches/example.wmap").expect("Failed to read benches/example.wmap"); + let example_map = wmap_parser::parse(&example_source); + + c.bench_function("render example map", |b| { + b.iter(|| render_to_surface(black_box(&example_map), StageType::default(), &config)) }); - // Also benchmark a simple map - let simple_source = "Tea (90, 50)\nCup (80, 40)\nTea -> Cup"; - let simple_map = wmap_parser::parse(simple_source); + let huge_source = fs::read_to_string("benches/huge.wmap").expect("Failed to read benches/huge.wmap"); + let huge_map = wmap_parser::parse(&huge_source); - c.bench_function("render simple map", |b| { - b.iter(|| render_to_png(black_box(&simple_map), StageType::default(), &config)) + c.bench_function("render huge map", |b| { + b.iter(|| render_to_surface(black_box(&huge_map), StageType::default(), &config)) }); } |