Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jquery bench #477

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions crates/parser/benches/jquery-3.5.0.slim.min.js

Large diffs are not rendered by default.

10 changes: 8 additions & 2 deletions crates/parser/benches/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,22 @@ use std::rc::Rc;

use bumpalo::Bump;
use jsparagus_ast::source_atom_set::SourceAtomSet;
use jsparagus_ast::source_slice_list::SourceSliceList;
use jsparagus_parser::{parse_script, ParseOptions};

fn parser_bench(c: &mut Criterion) {
let tests = &["simple", "__finStreamer-proto"];
let tests = &["simple", "__finStreamer-proto", "jquery-slim"];
let mut programs = HashMap::new();

programs.insert("simple", include_str!("./simple.js"));
programs.insert(
"__finStreamer-proto",
include_str!("./__finStreamer-proto.js"),
);
programs.insert(
"jquery-slim",
include_str!("./jquery-3.5.0.slim.min.js"),
);

c.bench_function_over_inputs(
"parser_bench",
Expand All @@ -27,7 +32,8 @@ fn parser_bench(c: &mut Criterion) {
let allocator = &Bump::new();
let options = ParseOptions::new();
let atoms = Rc::new(RefCell::new(SourceAtomSet::new()));
let _ = parse_script(allocator, program, &options, atoms.clone());
let slices = Rc::new(RefCell::new(SourceSliceList::new()));
let _ = parse_script(allocator, program, &options, atoms, slices);
});
},
tests,
Expand Down