-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimize a lot and deprecate
to_u8
methods (#7)
- Loading branch information
Showing
11 changed files
with
514 additions
and
282 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
target/ | ||
Cargo.lock | ||
.prettier-cache | ||
*.svg | ||
*.data | ||
*.data.old |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
use criterion::{criterion_group, criterion_main, Criterion}; | ||
use std::hint::black_box; | ||
use svg_path_cst::{svg_path_cst, SVGPathCSTNode, SyntaxError}; | ||
|
||
fn parse(data: &[u8]) -> Result<Vec<SVGPathCSTNode>, SyntaxError> { | ||
svg_path_cst(data) | ||
} | ||
|
||
fn performance(c: &mut Criterion) { | ||
let data = b"M 10 10 L 20 20"; | ||
c.bench_function("basic", |b| b.iter(|| parse(black_box(data)))); | ||
|
||
let simpleicons_data = include_bytes!("../fuzz/corpus/simpleicons.txt"); | ||
c.bench_function("simpleicons", |b| { | ||
b.iter(|| parse(black_box(simpleicons_data))) | ||
}); | ||
|
||
let elsevier_data = include_bytes!("../fuzz/corpus/elsevier.txt"); | ||
c.bench_function("elsevier", |b| b.iter(|| parse(black_box(elsevier_data)))); | ||
} | ||
|
||
criterion_group!(benches, performance); | ||
criterion_main!(benches); |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
M12 0C8.688 0 6 2.688 6 6s2.688 6 6 6c4.64-.001 7.526 5.039 5.176 9.04h1.68A7.507 7.507 0 0 0 12 10.5 4.502 4.502 0 0 1 7.5 6c0-2.484 2.016-4.5 4.5-4.5s4.5 2.016 4.5 4.5H18c0-3.312-2.688-6-6-6Zm0 3a3 3 0 0 0 0 6c4 0 4-6 0-6Zm0 1.5A1.5 1.5 0 0 1 13.5 6v.002c-.002 1.336-1.617 2.003-2.561 1.058C9.995 6.115 10.664 4.5 12 4.5ZM7.5 15v1.5H9v6H4.5V24h15v-1.5H15v-6h1.5V15Zm3 1.5h3v6h-3zm-6 1.47c0 1.09.216 2.109.644 3.069h1.684A5.957 5.957 0 0 1 6 17.97Z |
Oops, something went wrong.