Skip to content

Override fmt_dangling_comments for frequent nodes#6551

Merged
MichaReiser merged 1 commit intomainfrom
override-fmt-dangling
Aug 14, 2023
Merged

Override fmt_dangling_comments for frequent nodes#6551
MichaReiser merged 1 commit intomainfrom
override-fmt-dangling

Conversation

@MichaReiser
Copy link
Member

Summary

I noticed that fmt_dangling_comments for ExprName and ExprCompare shows up in flamegraphs.

This PR overrides fmt_dangling_comments for these expressions as we know that they can't have dangling comments. This comes at the risk
that we may drop such comment if this ever happens to change, but we have the assert_formatted_all_comments in debug builds that helps us catch unformatted comments.

Test Plan

cargo test

@MichaReiser
Copy link
Member Author

MichaReiser commented Aug 14, 2023

@github-actions
Copy link
Contributor

github-actions bot commented Aug 14, 2023

PR Check Results

Benchmark

Linux

group                                      main                                   pr
-----                                      ----                                   --
formatter/large/dataset.py                 1.02      4.6±0.12ms     8.9 MB/sec    1.00      4.5±0.12ms     9.1 MB/sec
formatter/numpy/ctypeslib.py               1.05   933.7±13.51µs    17.8 MB/sec    1.00   892.7±27.18µs    18.7 MB/sec
formatter/numpy/globals.py                 1.01     95.4±2.22µs    30.9 MB/sec    1.00     94.1±3.13µs    31.4 MB/sec
formatter/pydantic/types.py                1.03  1880.0±38.98µs    13.6 MB/sec    1.00  1831.0±50.22µs    13.9 MB/sec
linter/all-rules/large/dataset.py          1.00     11.9±0.23ms     3.4 MB/sec    1.01     12.1±0.24ms     3.4 MB/sec
linter/all-rules/numpy/ctypeslib.py        1.02      3.2±0.07ms     5.2 MB/sec    1.00      3.2±0.06ms     5.3 MB/sec
linter/all-rules/numpy/globals.py          1.02    465.1±5.99µs     6.3 MB/sec    1.00   455.1±10.59µs     6.5 MB/sec
linter/all-rules/pydantic/types.py         1.00      6.2±0.11ms     4.1 MB/sec    1.00      6.2±0.12ms     4.1 MB/sec
linter/default-rules/large/dataset.py      1.01      6.3±0.08ms     6.4 MB/sec    1.00      6.3±0.13ms     6.5 MB/sec
linter/default-rules/numpy/ctypeslib.py    1.02  1415.2±23.67µs    11.8 MB/sec    1.00  1392.6±35.36µs    12.0 MB/sec
linter/default-rules/numpy/globals.py      1.01    161.8±3.42µs    18.2 MB/sec    1.00    160.6±5.17µs    18.4 MB/sec
linter/default-rules/pydantic/types.py     1.04      2.9±0.03ms     8.8 MB/sec    1.00      2.8±0.06ms     9.1 MB/sec

Windows

group                                      main                                    pr
-----                                      ----                                    --
formatter/large/dataset.py                 1.05      5.2±0.30ms     7.9 MB/sec     1.00      4.9±0.33ms     8.3 MB/sec
formatter/numpy/ctypeslib.py               1.06  1026.5±90.81µs    16.2 MB/sec     1.00   970.8±65.60µs    17.2 MB/sec
formatter/numpy/globals.py                 1.02     99.5±9.27µs    29.6 MB/sec     1.00     98.0±6.66µs    30.1 MB/sec
formatter/pydantic/types.py                1.07      2.1±0.16ms    12.3 MB/sec     1.00  1943.7±119.46µs    13.1 MB/sec
linter/all-rules/large/dataset.py          1.00     15.2±0.71ms     2.7 MB/sec     1.05     15.9±0.70ms     2.6 MB/sec
linter/all-rules/numpy/ctypeslib.py        1.00      4.2±0.23ms     3.9 MB/sec     1.01      4.3±0.20ms     3.9 MB/sec
linter/all-rules/numpy/globals.py          1.00   541.1±30.80µs     5.5 MB/sec     1.02   549.8±21.89µs     5.4 MB/sec
linter/all-rules/pydantic/types.py         1.00      8.3±0.43ms     3.1 MB/sec     1.01      8.4±0.38ms     3.0 MB/sec
linter/default-rules/large/dataset.py      1.02      8.5±0.34ms     4.8 MB/sec     1.00      8.4±0.29ms     4.9 MB/sec
linter/default-rules/numpy/ctypeslib.py    1.03  1866.1±112.47µs     8.9 MB/sec    1.00  1806.6±119.80µs     9.2 MB/sec
linter/default-rules/numpy/globals.py      1.02   231.7±13.10µs    12.7 MB/sec     1.00   227.2±17.01µs    13.0 MB/sec
linter/default-rules/pydantic/types.py     1.07      4.0±0.18ms     6.4 MB/sec     1.00      3.7±0.17ms     6.9 MB/sec

@MichaReiser MichaReiser force-pushed the printer-reserve-buffer-upfront branch from 222bf7d to a97a59a Compare August 14, 2023 08:21
@MichaReiser MichaReiser mentioned this pull request Aug 14, 2023
@MichaReiser MichaReiser added the formatter Related to the formatter label Aug 14, 2023
@MichaReiser MichaReiser force-pushed the printer-reserve-buffer-upfront branch from a97a59a to 3076d97 Compare August 14, 2023 08:26
@MichaReiser MichaReiser force-pushed the override-fmt-dangling branch from 1297472 to 3ac7ec7 Compare August 14, 2023 08:28
@MichaReiser MichaReiser force-pushed the printer-reserve-buffer-upfront branch from 3076d97 to 2db43a5 Compare August 14, 2023 09:59
@MichaReiser MichaReiser force-pushed the override-fmt-dangling branch from 3ac7ec7 to 69e3a16 Compare August 14, 2023 09:59
@MichaReiser MichaReiser force-pushed the printer-reserve-buffer-upfront branch from 2db43a5 to 493a3b6 Compare August 14, 2023 12:03
@MichaReiser MichaReiser force-pushed the override-fmt-dangling branch from 69e3a16 to e015620 Compare August 14, 2023 12:03
Base automatically changed from printer-reserve-buffer-upfront to main August 14, 2023 12:15
@MichaReiser MichaReiser force-pushed the override-fmt-dangling branch from e015620 to e029db8 Compare August 14, 2023 12:32
@MichaReiser MichaReiser merged commit fc0c950 into main Aug 14, 2023
@MichaReiser MichaReiser deleted the override-fmt-dangling branch August 14, 2023 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

formatter Related to the formatter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants