Skip to content

feat(cli): add support for TIMING env var#535

Merged
Boshen merged 1 commit into
mainfrom
shannon/rule-execution-time
Jul 25, 2023
Merged

feat(cli): add support for TIMING env var#535
Boshen merged 1 commit into
mainfrom
shannon/rule-execution-time

Conversation

@shannonrothe

@shannonrothe shannonrothe commented Jul 10, 2023

Copy link
Copy Markdown
Contributor

Implements support for the TIMING environment variable in the linter/CLI. Setting TIMING=1 or TIMING=true before running the linter (via CLI) will record the time each rule takes as a whole across all files and print the result in a table after linting is complete.

@shannonrothe shannonrothe marked this pull request as draft July 10, 2023 10:23
Comment thread crates/oxc_linter/src/lib.rs Outdated
Comment thread Cargo.toml
crossbeam-channel = { version = "0.5.8" }
dashmap = { version = "5.4.0" }
flate2 = { version = "1.0.26" }
glob = { version = "0.3.1" }

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea why these were removed 🤔

Comment thread crates/oxc_linter/Cargo.toml Outdated
Comment thread crates/oxc_linter/src/lib.rs Outdated
@codecov

codecov Bot commented Jul 10, 2023

Copy link
Copy Markdown

Codecov Report

Merging #535 (3de5278) into main (6310625) will increase coverage by 0.41%.
The diff coverage is 89.43%.

❗ Current head 3de5278 differs from pull request most recent head fa6d331. Consider uploading reports for the commit fa6d331 to get more accurate results

@@            Coverage Diff             @@
##             main     #535      +/-   ##
==========================================
+ Coverage   89.26%   89.67%   +0.41%     
==========================================
  Files         154      181      +27     
  Lines       29760    35084    +5324     
==========================================
+ Hits        26566    31463    +4897     
- Misses       3194     3621     +427     
Impacted Files Coverage Δ
crates/oxc_ast/src/ast/jsx.rs 55.10% <ø> (ø)
crates/oxc_ast/src/ast_kind.rs 27.16% <0.00%> (+10.40%) ⬆️
crates/oxc_ast/src/lib.rs 0.00% <ø> (ø)
crates/oxc_ast/src/span.rs 36.25% <0.00%> (-1.94%) ⬇️
crates/oxc_cli/src/lib.rs 0.00% <0.00%> (ø)
crates/oxc_cli/src/lint/error.rs 0.00% <0.00%> (ø)
crates/oxc_cli/src/lint/runner.rs 0.00% <0.00%> (ø)
crates/oxc_cli/src/lint/runner_with_module_tree.rs 0.00% <0.00%> (ø)
crates/oxc_cli/src/result.rs 0.00% <0.00%> (ø)
crates/oxc_cli/src/type_check/mod.rs 0.00% <0.00%> (ø)
... and 126 more

... and 3 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@github-actions

github-actions Bot commented Jul 10, 2023

Copy link
Copy Markdown
Contributor

Benchmark Results

Linux

group                            main                                   pr
-----                            ----                                   --
minifier/antd.js                 1.02    230.1±2.42ms    27.7 MB/sec    1.00    226.2±2.51ms    28.2 MB/sec
minifier/react.development.js    1.00      2.7±0.01ms    25.4 MB/sec    1.00      2.7±0.01ms    25.5 MB/sec
minifier/typescript.js           1.05    411.0±4.05ms    25.1 MB/sec    1.00    392.1±3.90ms    26.3 MB/sec
minifier/vue.js                  1.03     17.0±0.19ms    19.2 MB/sec    1.00     16.5±0.18ms    19.7 MB/sec
parser/antd.js                   1.00     75.3±0.96ms    84.7 MB/sec    1.00     75.6±0.63ms    84.3 MB/sec
parser/react.development.js      1.00   857.0±18.66µs    80.3 MB/sec    1.01   863.8±16.57µs    79.6 MB/sec
parser/typescript.js             1.00    127.4±0.45ms    81.0 MB/sec    1.00    127.6±0.51ms    80.8 MB/sec
parser/vue.js                    1.00      5.7±0.06ms    57.6 MB/sec    1.02      5.8±0.21ms    56.5 MB/sec
semantic/antd.js                 1.00     70.3±2.95ms    90.7 MB/sec    1.01     70.9±3.38ms    90.0 MB/sec
semantic/react.development.js    1.00    879.0±8.69µs    78.3 MB/sec    1.01   885.5±12.57µs    77.7 MB/sec
semantic/typescript.js           1.00    158.0±6.18ms    65.3 MB/sec    1.00    158.0±5.78ms    65.3 MB/sec
semantic/vue.js                  1.00      5.8±0.06ms    56.2 MB/sec    1.01      5.9±0.05ms    55.5 MB/sec

Windows

group                            main                                   pr
-----                            ----                                   --
minifier/antd.js                 1.06   356.4±12.04ms    17.9 MB/sec    1.00    335.0±8.86ms    19.0 MB/sec
minifier/react.development.js    1.00      3.4±0.06ms    20.5 MB/sec    1.01      3.4±0.12ms    20.4 MB/sec
minifier/typescript.js           1.04   543.3±15.96ms    19.0 MB/sec    1.00   523.4±12.82ms    19.7 MB/sec
minifier/vue.js                  1.00     20.9±0.54ms    15.6 MB/sec    1.01     21.1±0.58ms    15.5 MB/sec
parser/antd.js                   1.28   112.8±34.58ms    56.5 MB/sec    1.00     87.8±2.10ms    72.6 MB/sec
parser/react.development.js      1.00   957.3±17.03µs    71.9 MB/sec    1.00   959.4±17.93µs    71.7 MB/sec
parser/typescript.js             1.36   196.7±74.26ms    52.5 MB/sec    1.00    145.0±2.42ms    71.1 MB/sec
parser/vue.js                    1.03      6.4±0.58ms    51.1 MB/sec    1.00      6.2±0.09ms    52.7 MB/sec
semantic/antd.js                 1.11    107.2±5.44ms    59.5 MB/sec    1.00     96.4±4.50ms    66.1 MB/sec
semantic/react.development.js    1.02  1164.5±45.70µs    59.1 MB/sec    1.00  1142.7±50.82µs    60.2 MB/sec
semantic/typescript.js           1.09   232.0±14.42ms    44.5 MB/sec    1.00   212.0±15.54ms    48.7 MB/sec
semantic/vue.js                  1.02      7.9±0.32ms    41.3 MB/sec    1.00      7.7±0.28ms    42.2 MB/sec

@shannonrothe shannonrothe force-pushed the shannon/rule-execution-time branch from 4e1e3b1 to fa6d331 Compare July 11, 2023 10:51
@Boshen Boshen force-pushed the shannon/rule-execution-time branch from fa6d331 to bf229bf Compare July 24, 2023 06:04
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@github-actions github-actions Bot added the A-linter Area - Linter label Jul 24, 2023
@Boshen Boshen marked this pull request as ready for review July 24, 2023 06:04
@Boshen

Boshen commented Jul 24, 2023

Copy link
Copy Markdown
Member

@shannonrothe Please take a look.

Output:

Rule timings in milliseconds:
Total: 7680.857ms
Time  |     % | Rule
207.966 |  2.7% | adjacent-overload-signatures
180.447 |  2.3% | use-isnan
172.007 |  2.2% | no-useless-escape
171.703 |  2.2% | no-cond-assign
164.159 |  2.1% | no-obj-calls
164.133 |  2.1% | no-control-regex

...

Finished in 4173ms on 4413 files with 52 rules using 12 threads.
Found 1562 warnings.

@Boshen Boshen force-pushed the shannon/rule-execution-time branch from bf229bf to 92631cf Compare July 25, 2023 02:37

@shannonrothe shannonrothe left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good (I can't approve it) 🚀

Do you think it's worth determining max width of each column so the output is properly aligned?

@Boshen

Boshen commented Jul 25, 2023

Copy link
Copy Markdown
Member

Do you think it's worth determining max width of each column so the output is properly aligned?

I'll bike shed a bit later 😄

@Boshen

Boshen commented Jul 25, 2023

Copy link
Copy Markdown
Member

By passing CLA because this PR was submitted before the org move.

@Boshen Boshen merged commit 21f8abe into main Jul 25, 2023
@Boshen Boshen deleted the shannon/rule-execution-time branch July 25, 2023 03:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-linter Area - Linter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants