biomejs / biome

A toolchain for web projects, aimed to provide functionalities to maintain them. Biome offers formatter and linter, usable via CLI and LSP.
https://biomejs.dev
Apache License 2.0
12.26k stars 392 forks source link

📎 Rule Benchmarking #857

Open victor-teles opened 7 months ago

victor-teles commented 7 months ago

Description

So that we can be more efficient when developing and modifying rules while ensuring that performance remains high. I would like to propose a new command-line that will individually benchmark each rule, following the current benchmark standards we already use.

The proposed command

cargo run -p xtask_bench --release -- --feature rule [ruleName]

and an alias

cargo bench_rule [ruleName]

Test data

For test data, we'll reuse current invalid.{ts,json,js,tsx,jsx} test files from rules.

Github PR comment action

As we've an comment action to run the benchmark for bench_analyzer, bench_cli,bench_formatter and bench_parser We can also introduce a new comment action for rules: !bench_rule [rule_name]

Output

Rule performance result

bench/rule.ts

Test result main count This PR count Difference
Total 49701 49701 0
Passed 48721 48721 0
Failed 980 980 0
Panics 0 0 0
Coverage 98.03% 98.03% 0.00%
ematipico commented 7 months ago

Thank you Victor for taking the lead.

Here's some thoughts that could help you:

victor-teles commented 7 months ago

@ematipico

Thank you for the feedback! Your thoughts make sense to me, I'll update the task description

net-tech commented 6 months ago

I don't know much about Biome's internal benchmarking structure but it could be useful to use https://codspeed.io which comments on PRs with any performance changes that have happened.

ematipico commented 6 months ago

Yeah I plan to set it up in the next few weeks :)