mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
The lexer benchmarks had a problem. The lexer alone cannot make sense of regexp literals, template literals, or JSX text elements - it needs the parser "driving" it. So lexer was producing plenty of errors on some benchmarks. This is unrealistic - when driven by the parser, the lexer produces no errors. Generating diagnostics is relatively expensive, so this was skewing the benchmarks somewhat. Solve this by cleaning up the input source text to replace these syntaxes with string literals prior to running the benchmarks. Unfortunately lexer benchmarks don't exercise the code paths for these syntaxes, but there isn't much we can do about that. We can judge by the parser benchmarks, which are the more important ones anyway.
152 lines
3.6 KiB
TOML
152 lines
3.6 KiB
TOML
[package]
|
|
name = "oxc_benchmark"
|
|
version = "0.0.0"
|
|
authors.workspace = true
|
|
edition.workspace = true
|
|
homepage.workspace = true
|
|
keywords.workspace = true
|
|
license.workspace = true
|
|
publish = false
|
|
repository.workspace = true
|
|
description.workspace = true
|
|
|
|
[lints]
|
|
workspace = true
|
|
|
|
[lib]
|
|
test = false
|
|
bench = false
|
|
doctest = false
|
|
|
|
[[bench]]
|
|
name = "lexer"
|
|
harness = false
|
|
|
|
[[bench]]
|
|
name = "parser"
|
|
harness = false
|
|
|
|
[[bench]]
|
|
name = "transformer"
|
|
harness = false
|
|
|
|
[[bench]]
|
|
name = "semantic"
|
|
harness = false
|
|
|
|
[[bench]]
|
|
name = "linter"
|
|
harness = false
|
|
|
|
[[bench]]
|
|
name = "codegen"
|
|
harness = false
|
|
|
|
# Broken
|
|
# [[bench]]
|
|
# name = "prettier"
|
|
# harness = false
|
|
|
|
[[bench]]
|
|
name = "minifier"
|
|
harness = false
|
|
|
|
[[bench]]
|
|
name = "isolated_declarations"
|
|
harness = false
|
|
|
|
# Only run in CI
|
|
[[bench]]
|
|
name = "parser_napi"
|
|
harness = false
|
|
bench = false
|
|
|
|
# All `oxc_*` dependencies optional as on CI we build each benchmark separately
|
|
# with only the crates it needs, to speed up the builds
|
|
[dependencies]
|
|
oxc_allocator = { workspace = true, optional = true }
|
|
oxc_ast = { workspace = true, optional = true }
|
|
oxc_codegen = { workspace = true, optional = true }
|
|
oxc_isolated_declarations = { workspace = true, optional = true }
|
|
oxc_linter = { workspace = true, optional = true }
|
|
oxc_mangler = { workspace = true, optional = true }
|
|
oxc_minifier = { workspace = true, optional = true }
|
|
oxc_parser = { workspace = true, features = ["benchmarking"], optional = true }
|
|
oxc_prettier = { workspace = true, optional = true }
|
|
oxc_semantic = { workspace = true, optional = true }
|
|
oxc_span = { workspace = true, optional = true, features = ["schemars", "serialize"] }
|
|
oxc_tasks_common = { workspace = true, optional = true }
|
|
oxc_transformer = { workspace = true, optional = true }
|
|
|
|
criterion2 = { workspace = true }
|
|
|
|
# Only for NAPI benchmark
|
|
serde = { workspace = true, optional = true }
|
|
serde_json = { workspace = true, optional = true }
|
|
|
|
[features]
|
|
default = [
|
|
"dep:oxc_allocator",
|
|
"dep:oxc_ast",
|
|
"dep:oxc_codegen",
|
|
"dep:oxc_isolated_declarations",
|
|
"dep:oxc_linter",
|
|
"dep:oxc_minifier",
|
|
"dep:oxc_mangler",
|
|
"dep:oxc_parser",
|
|
"dep:oxc_prettier",
|
|
"dep:oxc_semantic",
|
|
"dep:oxc_span",
|
|
"dep:oxc_tasks_common",
|
|
"dep:oxc_transformer",
|
|
]
|
|
codspeed = ["criterion2/codspeed"]
|
|
codspeed_napi = ["criterion2/codspeed", "dep:serde", "dep:serde_json"]
|
|
|
|
# Features for running each benchmark separately with minimum dependencies that benchmark needs.
|
|
# e.g. `cargo build --release -p oxc_benchmark --bench parser --no-default-features --features parser`
|
|
lexer = ["dep:oxc_allocator", "dep:oxc_ast", "dep:oxc_parser", "dep:oxc_span", "dep:oxc_tasks_common"]
|
|
parser = ["dep:oxc_allocator", "dep:oxc_parser", "dep:oxc_span", "dep:oxc_tasks_common"]
|
|
transformer = [
|
|
"dep:oxc_allocator",
|
|
"dep:oxc_parser",
|
|
"dep:oxc_semantic",
|
|
"dep:oxc_span",
|
|
"dep:oxc_tasks_common",
|
|
"dep:oxc_transformer",
|
|
]
|
|
semantic = ["dep:oxc_allocator", "dep:oxc_parser", "dep:oxc_semantic", "dep:oxc_span", "dep:oxc_tasks_common"]
|
|
minifier = [
|
|
"dep:oxc_allocator",
|
|
"dep:oxc_minifier",
|
|
"dep:oxc_mangler",
|
|
"dep:oxc_parser",
|
|
"dep:oxc_semantic",
|
|
"dep:oxc_span",
|
|
"dep:oxc_tasks_common",
|
|
]
|
|
codegen = [
|
|
"dep:oxc_allocator",
|
|
"dep:oxc_codegen",
|
|
"dep:oxc_parser",
|
|
"dep:oxc_semantic",
|
|
"dep:oxc_span",
|
|
"dep:oxc_tasks_common",
|
|
"dep:oxc_transformer",
|
|
]
|
|
linter = [
|
|
"dep:oxc_allocator",
|
|
"dep:oxc_linter",
|
|
"dep:oxc_parser",
|
|
"dep:oxc_semantic",
|
|
"dep:oxc_span",
|
|
"dep:oxc_tasks_common",
|
|
]
|
|
prettier = ["dep:oxc_allocator", "dep:oxc_parser", "dep:oxc_prettier", "dep:oxc_span", "dep:oxc_tasks_common"]
|
|
isolated_declarations = [
|
|
"dep:oxc_allocator",
|
|
"dep:oxc_isolated_declarations",
|
|
"dep:oxc_parser",
|
|
"dep:oxc_span",
|
|
"dep:oxc_tasks_common",
|
|
]
|