Skip to content

Document shrinking script#5942

Merged
konstin merged 2 commits intomainfrom
document-shrinking-script
Jul 21, 2023
Merged

Document shrinking script#5942
konstin merged 2 commits intomainfrom
document-shrinking-script

Conversation

@konstin
Copy link
Copy Markdown
Member

@konstin konstin commented Jul 21, 2023

Summary Document shrinking script: I thinks it's both in a good enough state and valuable enough to document it's usage.

konstin added 2 commits July 21, 2023 10:22
**Summary** This adds a sanity check to the minimizer script that the
input matches the condition (e.g. unstable formatting). Otherwise we run
through all checks with the whole file, which is extremely slow. It's
more reasonable for downstream usage to write an empty string to the
output file instead. It also prints the minimized code in the end
@konstin
Copy link
Copy Markdown
Member Author

konstin commented Jul 21, 2023

Current dependencies on/for this PR:

This comment was auto-generated by Graphite.

@github-actions
Copy link
Copy Markdown
Contributor

PR Check Results

Benchmark

Linux

group                                      main                                   pr
-----                                      ----                                   --
formatter/large/dataset.py                 1.09     12.0±0.04ms     3.4 MB/sec    1.00     11.0±0.02ms     3.7 MB/sec
formatter/numpy/ctypeslib.py               1.06      2.4±0.00ms     7.1 MB/sec    1.00      2.2±0.06ms     7.5 MB/sec
formatter/numpy/globals.py                 1.04    254.7±2.66µs    11.6 MB/sec    1.00    246.0±0.37µs    12.0 MB/sec
formatter/pydantic/types.py                1.07      5.1±0.01ms     5.0 MB/sec    1.00      4.8±0.01ms     5.3 MB/sec
linter/all-rules/large/dataset.py          1.06     16.4±0.04ms     2.5 MB/sec    1.00     15.4±0.05ms     2.6 MB/sec
linter/all-rules/numpy/ctypeslib.py        1.04      4.1±0.02ms     4.1 MB/sec    1.00      3.9±0.02ms     4.2 MB/sec
linter/all-rules/numpy/globals.py          1.01    528.6±1.49µs     5.6 MB/sec    1.00    522.5±0.84µs     5.6 MB/sec
linter/all-rules/pydantic/types.py         1.05      7.3±0.01ms     3.5 MB/sec    1.00      7.0±0.01ms     3.7 MB/sec
linter/default-rules/large/dataset.py      1.13      8.9±0.02ms     4.6 MB/sec    1.00      7.9±0.02ms     5.2 MB/sec
linter/default-rules/numpy/ctypeslib.py    1.09   1839.7±5.38µs     9.1 MB/sec    1.00   1681.5±4.20µs     9.9 MB/sec
linter/default-rules/numpy/globals.py      1.07    199.2±0.52µs    14.8 MB/sec    1.00    185.8±0.34µs    15.9 MB/sec
linter/default-rules/pydantic/types.py     1.11      3.9±0.01ms     6.5 MB/sec    1.00      3.5±0.01ms     7.2 MB/sec

Windows

group                                      main                                   pr
-----                                      ----                                   --
formatter/large/dataset.py                 1.00     15.0±0.41ms     2.7 MB/sec    1.02     15.3±0.36ms     2.7 MB/sec
formatter/numpy/ctypeslib.py               1.01      2.9±0.10ms     5.7 MB/sec    1.00      2.9±0.07ms     5.8 MB/sec
formatter/numpy/globals.py                 1.00    324.7±9.31µs     9.1 MB/sec    1.03   335.4±20.74µs     8.8 MB/sec
formatter/pydantic/types.py                1.00      6.3±0.17ms     4.0 MB/sec    1.01      6.4±0.19ms     4.0 MB/sec
linter/all-rules/large/dataset.py          1.00     21.9±0.45ms  1901.2 KB/sec    1.00     21.8±0.44ms  1907.0 KB/sec
linter/all-rules/numpy/ctypeslib.py        1.01      5.7±0.12ms     2.9 MB/sec    1.00      5.6±0.12ms     3.0 MB/sec
linter/all-rules/numpy/globals.py          1.00   665.9±26.97µs     4.4 MB/sec    1.00   665.8±24.03µs     4.4 MB/sec
linter/all-rules/pydantic/types.py         1.00      9.8±0.27ms     2.6 MB/sec    1.01      9.9±0.27ms     2.6 MB/sec
linter/default-rules/large/dataset.py      1.01     11.8±0.28ms     3.5 MB/sec    1.00     11.7±0.27ms     3.5 MB/sec
linter/default-rules/numpy/ctypeslib.py    1.01      2.4±0.06ms     7.1 MB/sec    1.00      2.3±0.05ms     7.1 MB/sec
linter/default-rules/numpy/globals.py      1.01   279.8±13.16µs    10.5 MB/sec    1.00    278.3±8.44µs    10.6 MB/sec
linter/default-rules/pydantic/types.py     1.00      5.0±0.13ms     5.1 MB/sec    1.01      5.1±0.14ms     5.0 MB/sec

Base automatically changed from Don_t_minimize_files_that_don_t_match_in_the_first_place to main July 21, 2023 09:32
@konstin konstin merged commit f6b40a0 into main Jul 21, 2023
@konstin konstin deleted the document-shrinking-script branch July 21, 2023 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants