Graphite/libraries/path-bool/benches/painted_dreams.rs
Dennis Kobert 8a1089938e
Path Bool library code cleanup (#2000)
* Remove log statements

* Add feature gates to functions in path.rs

* Fix infinite parsing loop and add new test

* License tweaks

* Remove trailing zero in whole number floats

* Flatten visual-tests directory

* Code review

* Clean up printlines

* Add error handling to path parsing

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2024-09-23 12:16:31 +02:00

16 lines
924 B
Rust

use criterion::{black_box, criterion_group, criterion_main, Criterion};
use path_bool::*;
pub fn criterion_benchmark(c: &mut Criterion) {
let path_a =
path_from_path_data("M0,340C161.737914,383.575765 107.564182,490.730587 273,476 C419,463 481.741198,514.692273 481.333333,768 C481.333333,768 -0,768 -0,768 C-0,768 0,340 0,340 Z").unwrap();
let path_b = path_from_path_data(
"M458.370270,572.165771C428.525848,486.720093 368.618805,467.485992 273,476 C107.564178,490.730591 161.737915,383.575775 0,340 C0,340 0,689 0,689 C56,700 106.513901,779.342590 188,694.666687 C306.607422,571.416260 372.033966,552.205139 458.370270,572.165771 Z",
).unwrap();
c.bench_function("painted_dreams_diff", |b| {
b.iter(|| path_boolean(black_box(&path_a), FillRule::NonZero, black_box(&path_b), FillRule::NonZero, PathBooleanOperation::Difference))
});
}
criterion_group!(benches, criterion_benchmark);
criterion_main!(benches);