Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a match statement for builtin detection #5798

Merged
merged 1 commit into from
Jul 16, 2023
Merged

Conversation

charliermarsh
Copy link
Member

Summary

We've seen speed-ups in the past by converting from slice iteration to match statements; this just does the same for built-in checks.

@charliermarsh charliermarsh added the internal An internal refactor or improvement label Jul 16, 2023
@charliermarsh charliermarsh enabled auto-merge (squash) July 16, 2023 04:42
@charliermarsh charliermarsh merged commit d692ed0 into main Jul 16, 2023
15 checks passed
@charliermarsh charliermarsh deleted the charlie/builtin branch July 16, 2023 04:58
@github-actions
Copy link
Contributor

github-actions bot commented Jul 16, 2023

PR Check Results

Ecosystem

ℹ️ ecosystem check detected changes. (+1, -1, 0 error(s))

bokeh (+1, -1)

- src/bokeh/models/callbacks.py:25:1: A001 Variable `any` is shadowing a Python builtin
+ src/bokeh/models/callbacks.py:25:42: A001 Variable `any` is shadowing a Python builtin

Rules changed: 1
Rule Changes Additions Removals
A001 2 1 1

Benchmark

Linux

group                                      main                                   pr
-----                                      ----                                   --
formatter/large/dataset.py                 1.00     11.1±0.06ms     3.7 MB/sec    1.02     11.3±0.06ms     3.6 MB/sec
formatter/numpy/ctypeslib.py               1.00      2.2±0.01ms     7.5 MB/sec    1.01      2.2±0.02ms     7.4 MB/sec
formatter/numpy/globals.py                 1.00    250.6±0.59µs    11.8 MB/sec    1.00    250.8±4.89µs    11.8 MB/sec
formatter/pydantic/types.py                1.00      4.8±0.01ms     5.3 MB/sec    1.00      4.8±0.01ms     5.3 MB/sec
linter/all-rules/large/dataset.py          1.01     16.2±0.15ms     2.5 MB/sec    1.00     16.0±0.11ms     2.5 MB/sec
linter/all-rules/numpy/ctypeslib.py        1.01      4.1±0.03ms     4.1 MB/sec    1.00      4.1±0.02ms     4.1 MB/sec
linter/all-rules/numpy/globals.py          1.00    540.0±2.73µs     5.5 MB/sec    1.00    538.5±0.99µs     5.5 MB/sec
linter/all-rules/pydantic/types.py         1.01      7.3±0.11ms     3.5 MB/sec    1.00      7.2±0.05ms     3.5 MB/sec
linter/default-rules/large/dataset.py      1.02      8.2±0.04ms     5.0 MB/sec    1.00      8.1±0.03ms     5.0 MB/sec
linter/default-rules/numpy/ctypeslib.py    1.01   1795.6±3.57µs     9.3 MB/sec    1.00   1774.4±4.59µs     9.4 MB/sec
linter/default-rules/numpy/globals.py      1.01    205.8±0.40µs    14.3 MB/sec    1.00    203.4±2.70µs    14.5 MB/sec
linter/default-rules/pydantic/types.py     1.01      3.7±0.02ms     6.9 MB/sec    1.00      3.6±0.01ms     7.0 MB/sec

Windows

group                                      main                                   pr
-----                                      ----                                   --
formatter/large/dataset.py                 1.00     11.3±0.36ms     3.6 MB/sec    1.01     11.4±0.35ms     3.6 MB/sec
formatter/numpy/ctypeslib.py               1.00      2.2±0.12ms     7.6 MB/sec    1.01      2.2±0.06ms     7.6 MB/sec
formatter/numpy/globals.py                 1.00    245.1±7.82µs    12.0 MB/sec    1.02   249.7±10.35µs    11.8 MB/sec
formatter/pydantic/types.py                1.00      4.8±0.11ms     5.3 MB/sec    1.01      4.8±0.15ms     5.3 MB/sec
linter/all-rules/large/dataset.py          1.01     16.1±0.29ms     2.5 MB/sec    1.00     16.0±0.32ms     2.5 MB/sec
linter/all-rules/numpy/ctypeslib.py        1.00      4.2±0.08ms     4.0 MB/sec    1.07      4.5±0.63ms     3.7 MB/sec
linter/all-rules/numpy/globals.py          1.00   507.8±10.18µs     5.8 MB/sec    1.01   513.6±26.43µs     5.7 MB/sec
linter/all-rules/pydantic/types.py         1.00      7.3±0.19ms     3.5 MB/sec    1.02      7.5±0.75ms     3.4 MB/sec
linter/default-rules/large/dataset.py      1.00      8.3±0.13ms     4.9 MB/sec    1.00      8.3±0.14ms     4.9 MB/sec
linter/default-rules/numpy/ctypeslib.py    1.00  1753.5±41.72µs     9.5 MB/sec    1.01  1771.7±63.67µs     9.4 MB/sec
linter/default-rules/numpy/globals.py      1.00    204.4±7.71µs    14.4 MB/sec    1.01    206.4±9.56µs    14.3 MB/sec
linter/default-rules/pydantic/types.py     1.00      3.7±0.12ms     6.9 MB/sec    1.01      3.8±0.13ms     6.8 MB/sec

evanrittenhouse pushed a commit to evanrittenhouse/ruff that referenced this pull request Jul 19, 2023
## Summary

We've seen speed-ups in the past by converting from slice iteration to
match statements; this just does the same for built-in checks.
konstin pushed a commit that referenced this pull request Jul 19, 2023
## Summary

We've seen speed-ups in the past by converting from slice iteration to
match statements; this just does the same for built-in checks.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal An internal refactor or improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant