GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — refactor: stop compiling the AI catalog and loading urllib at import by shenxianpeng · Pull Request #693 · commit-check/commit-check Conversation
|
| Command | main | this PR | Change |
|---|---|---|---|
commit-check -m <file> |
474M | 242M | −49% |
commit-check -b |
475M | 237M | −50% |
commit-check -m -b -n -e |
483M | 250M | −48% |
-m <file> with ai_attribution = "forbid" |
541M | 312M | −42% |
commit-check --version |
469M | 292M | −38% |
Wall clock, median of 40 runs:
| Command | main | this PR |
|---|---|---|
commit-check -m <file> |
123 ms | 71 ms |
commit-check -m -b -n -e |
152 ms | 104 ms |
For reference, 2.15.0 measured 317M for -m <file>, so this also takes startup below where it was before the AI rules were added.
Regexes compiled at import: 193 before, 29 after.
tests/startup_test.py imports the CLI in a fresh interpreter. It fails if that import loads importlib.metadata, urllib, http.client or ssl, compiles any AI signature pattern, or compiles more than 40 regexes. One new benchmark, test_compiling_the_catalog_cold, measures what the first AI scan of a run pays. CodSpeed will flag it as the catalog grows.
ruff check, ruff format --check and mypy are clean.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Pre-merge checks:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Every pre-commit hook run, and every commit the Action or the App checks, starts a fresh interpreter, so import work is paid once per commit. It had grown by about half since 2.15: importing the CLI compiled all 160+ AI signature regexes, although ai_attribution is off by default, and loaded urllib and importlib.metadata, which only inherit_from URLs and --version use. - Signature patterns keep their source and compile on first use. ALL_PATTERNS is built when something asks for it. - The HTTPS-only opener moves to commit_check._https and is imported when a parent config is fetched. - __version__ is read from the package metadata when it is asked for. CPU instructions for `commit-check -m <file>` drop from 478M to about 250M (python itself is 75M). The benchmarks time test bodies after everything is imported, so they could not see this; startup_test.py now fails if import pulls these modules back in or compiles the catalog, and one benchmark measures the catalog's cold compile as it grows.
9fd940d to
4e1c012
Compare
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@ ## main #693 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 14 15 +1 Lines 2552 2587 +35 Branches 499 502 +3 ========================================= + Hits 2552 2587 +35 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Merging this PR will improve performance by ×2.12 warnings, 1 note
Performance Changes
Tip Curious why performance improved? Comment Comparing Footnotes
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.