ESLint Rule Benchmark times individual ESLint rules, capturing ops/sec, mean and median runtimes and rich latency percentiles to surface performance hotspots.
It helps you catch regressions and quantify optimization gains.
Key Features
Prevent performance regressions – catch slow rules before they reach production
Compare implementations – find the fastest approach with side-by-side benchmarks
Expose detailed metrics – ops/sec, mean, median, percentiles and more
Track performance trends – export JSON results for historical analysis
Benchmark real code – measure against actual projects, not synthetic snippets
Use TypeScript natively – run .ts rules out of the box
Automate CI/CD checks – post performance impact straight to pull requests
Generate multiple report formats – output to console, JSON or Markdown
By default, eslint-rule-benchmark run will look for the config.{js,cjs,mts,ts,cts,mts} configuration file in the ./benchmark/ directory.
The configuration file should export a configuration object, preferably using the defineConfig helper for type safety and autocompletion.
1import { defineConfig } from'eslint-rule-benchmark'23exportdefault defineConfig({
4/* Number of measurement iterations. Default: 1000. */5iterations: 1000,
67/* Warmup configuration. */8warmup: {
9/* Number of warmup iterations. Default: 100. */10iterations: 100,
1112/* Whether to enable warmup. Default: true. */13enabled: true,
14 },
15/* Max time per benchmark. Default: 5000. */16timeout: 5000,
1718/* Array of benchmark test specifications. */19tests: [
20 {
21/* Descriptive name for this test group/specification. */22name: 'Rule: sort-imports',
2324/* ESLint rule identifier. */25ruleId: 'sort-imports',
2627/* Path to the rule's implementation. */28rulePath: '../lib/rules/sort-imports.ts',
2930/* Override global benchmark settings for this specific test group. */31iterations: 50,
32timeout: 300,
33warmup: {
34iterations: 10,
35 },
3637/* Array of test cases for this rule. */38cases: [
39 {
40testPath: './sort-imports/base-case.ts',
4142/* ESLint rule options specific to this case. */43options: [{ order: 'asc', ignoreCase: true }],
4445/* ESLint rule severity for this case (0, 1, 2). Default: 2. */46severity: 2,
47 },
48 {
49testPath: './sort-imports/complex-case.ts',
50 },
51 ],
52 },
53 {
54name: 'Rule: sort-vars',
55ruleId: 'sort-vars',
56rulePath: '../lib/rules/sort-vars.ts',
57cases: [
58 {
59testPath: './sort-vars/base-case.ts',
60 },
61 ],
62 },
63/* ... more test specifications */64 ],
65})
Metrics and Output
ESLint Rule Benchmark provides the following performance metrics:
Metric
Description
Operations per second
Number of operations per second
Average time
Average execution time of the rule (e.g., in ms)
Median time (P50)
Median execution time (50th percentile)
Minimum time
Minimum execution time
Maximum time
Maximum execution time
Standard deviation
Standard deviation (measure of time variability)
Metrics are available in Console, JSON, and Markdown formats, allowing integration with various systems and workflows.
Example Output
------------------------------------------------------------------------------------------------------
Rule: sort-imports
------------------------------------------------------------------------------------------------------
Sample | Ops/sec | Avg Time | Median | Min | Max | StdDev | Samples
base-alphabetical.ts | 7,569 ops/sec | 0.132 ms | 0.131 ms | 0.125 ms | 0.148 ms | ±0.004 ms | 7,421
base-natural.ts | 7,485 ops/sec | 0.134 ms | 0.132 ms | 0.126 ms | 0.151 ms | ±0.005 ms | 7,010
base-line-length.ts | 7,508 ops/sec | 0.133 ms | 0.131 ms | 0.125 ms | 0.150 ms | ±0.005 ms | 7,828
------------------------------------------------------------------------------------------------------
System Information:
Runtime: Node.js v22.15.1, V8 12.4.254.21-node.24, ESLint 9.25.1
Platform: darwin arm64 (24.5.0)
Hardware: Apple M1 Pro (10 cores, 2400 MHz), 32 GB RAM
GitHub Actions Integration
ESLint Rule Benchmark automatically publishes benchmark results as comments to GitHub Pull Requests when running in GitHub Actions environment.
Setup
ESLint Rule Benchmark automatically posts benchmark results as comments on pull requests.