New benchmark for parsing binary expressions (#957)

This commit is contained in:
Adam Chalmers
2023-10-31 13:04:24 -05:00
committed by GitHub
parent 9b55b1fd12
commit 387f7e0912
2 changed files with 22 additions and 0 deletions

View File

@ -11,6 +11,7 @@ pub fn bench_parse(c: &mut Criterion) {
("pipes_on_pipes", PIPES_PROGRAM),
("big_kitt", KITT_PROGRAM),
("cube", CUBE_PROGRAM),
("math", MATH_PROGRAM),
] {
let tokens = kcl_lib::token::lexer(file);
c.bench_function(&format!("parse_{name}"), move |b| {
@ -33,3 +34,4 @@ criterion_main!(benches);
const KITT_PROGRAM: &str = include_str!("../../tests/executor/inputs/kittycad_svg.kcl");
const PIPES_PROGRAM: &str = include_str!("../../tests/executor/inputs/pipes_on_pipes.kcl");
const CUBE_PROGRAM: &str = include_str!("../../tests/executor/inputs/cube.kcl");
const MATH_PROGRAM: &str = include_str!("../../tests/executor/inputs/math.kcl");

View File

@ -0,0 +1,20 @@
const svg = startSketchOn('XY')
|> lineTo([0])
|> lineTo([0 + 1])
|> lineTo([0 + 1 + 2])
|> lineTo([0 + 1 + 2 + 3])
|> lineTo([0 + 1 + 2 + 3 + 4])
|> lineTo([0 + 1 + 2 + 3 + 4 + 5])
|> lineTo([0 + 1 + 2 + 3 + 4 + 5 + 6])
|> lineTo([0 + 1 + 2 + 3 + 4 + 5 + 6 + 7])
|> lineTo([0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8])
|> lineTo([0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9])
|> lineTo([0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10])
|> lineTo([0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11])
|> lineTo([0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12])
|> lineTo([0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13])
|> lineTo([0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14])
|> lineTo([0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15])
|> lineTo([0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16])
|> lineTo([0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17])
|> lineTo([0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18])