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

chore(benchmark): turn on all lints #892

Merged
merged 1 commit into from
Sep 10, 2023
Merged
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
14 changes: 7 additions & 7 deletions tasks/benchmark/benches/linter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ static GLOBAL: jemallocator::Jemalloc = jemallocator::Jemalloc;
#[global_allocator]
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;

use std::rc::Rc;
use std::{path::PathBuf, rc::Rc};

use oxc_allocator::Allocator;
use oxc_benchmark::{criterion_group, criterion_main, BenchmarkId, Criterion};
use oxc_linter::{LintContext, Linter};
use oxc_linter::{AllowWarnDeny, LintContext, LintOptions, Linter};
use oxc_parser::Parser;
use oxc_semantic::SemanticBuilder;
use oxc_span::SourceType;
Expand All @@ -29,13 +29,13 @@ fn bench_linter(criterion: &mut Criterion) {
let program = allocator.alloc(ret.program);
let semantic_ret = SemanticBuilder::new(source_text, source_type)
.with_trivias(ret.trivias)
.build_module_record(PathBuf::new(), program)
.build(program);
let linter = Linter::new();
let lint_options =
LintOptions::default().with_filter(vec![(AllowWarnDeny::Deny, "all".into())]);
let linter = Linter::from_options(lint_options);
let semantic = Rc::new(semantic_ret.semantic);
b.iter_with_large_drop(|| {
let ctx = LintContext::new(&Rc::clone(&semantic));
linter.run(ctx)
});
b.iter(|| linter.run(LintContext::new(&semantic)));
},
);
}
Expand Down
Loading