Skip to content

Build call keywords directly in ThinVec - #26227

Closed
MichaReiser wants to merge 3 commits into
mainfrom
micha/ruff-keyword-thinvec
Closed

Build call keywords directly in ThinVec#26227
MichaReiser wants to merge 3 commits into
mainfrom
micha/ruff-keyword-thinvec

Conversation

@MichaReiser

Copy link
Copy Markdown
Member

Build call keyword lists directly in their final ThinVec, reserving the first slot lazily so calls without keywords remain allocation-free.
In a Django DHAT run, this removed 29.9 MB of total allocations and reduced peak live memory by 245 KB.
Testing: Passed the parser test suite and repository hooks.

@MichaReiser MichaReiser added performance Potential performance improvement parser Related to the parser labels Jun 22, 2026
@astral-sh-bot

astral-sh-bot Bot commented Jun 22, 2026

Copy link
Copy Markdown

Memory usage report

Summary

Project Old New Diff Outcome
flake8 30.82MB 30.77MB -0.14% (45.12kB) ⬇️
sphinx 193.95MB 193.89MB -0.03% (62.73kB) ⬇️
trio 77.57MB 77.49MB -0.09% (72.54kB) ⬇️
prefect 518.54MB 518.46MB -0.01% (78.57kB) ⬇️

Significant changes

Click to expand detailed breakdown

flake8

Name Old New Diff Outcome
parsed_module 9.76MB 9.72MB -0.45% (45.12kB) ⬇️

sphinx

Name Old New Diff Outcome
parsed_module 18.37MB 18.31MB -0.33% (62.73kB) ⬇️

trio

Name Old New Diff Outcome
parsed_module 15.05MB 14.98MB -0.47% (72.54kB) ⬇️

prefect

Name Old New Diff Outcome
parsed_module 19.36MB 19.28MB -0.40% (78.57kB) ⬇️

@astral-sh-bot

astral-sh-bot Bot commented Jun 22, 2026

Copy link
Copy Markdown

ecosystem-analyzer results

No diagnostic changes detected ✅

Full report with detailed diff (timing results)

@codspeed-hq

codspeed-hq Bot commented Jun 22, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 6.39%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 1 improved benchmark
✅ 130 untouched benchmarks
⏩ 4 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Memory parser[large/dataset.py] 776.3 KB 729.7 KB +6.39%

Tip

Curious why this is faster? Use the CodSpeed MCP and ask your agent.


Comparing micha/ruff-keyword-thinvec (a9bdfe1) with main (8c03352)

Open in CodSpeed

Footnotes

  1. 4 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@astral-sh-bot

astral-sh-bot Bot commented Jun 22, 2026

Copy link
Copy Markdown

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Formatter (stable)

✅ ecosystem check detected no format changes.

Formatter (preview)

ℹ️ ecosystem check encountered format errors. (no format changes; 1 project error)

apache/airflow (error)

ruff format --preview

warning: Detected debug build without --no-cache.
error: Encountered error: No such file or directory (os error 2)
error: Encountered error: No such file or directory (os error 2)
error: Encountered error: No such file or directory (os error 2)
error: Encountered error: No such file or directory (os error 2)
error: Encountered error: No such file or directory (os error 2)
error: Encountered error: No such file or directory (os error 2)
error: Encountered error: No such file or directory (os error 2)
error: Encountered error: No such file or directory (os error 2)
error: Encountered error: No such file or directory (os error 2)
error: Encountered error: No such file or directory (os error 2)
error: Encountered error: No such file or directory (os error 2)
error: Encountered error: No such file or directory (os error 2)
error: Encountered error: No such file or directory (os error 2)
error: Encountered error: No such file or directory (os error 2)
error: Encountered error: No such file or directory (os error 2)
error: Encountered error: No such file or directory (os error 2)
error: Encountered error: No such file or directory (os error 2)
error: Encountered error: No such file or directory (os error 2)
error: Encountered error: No such file or directory (os error 2)
error: Encountered error: No such file or directory (os error 2)
error: Encountered error: No such file or directory (os error 2)
error: Encountered error: No such file or directory (os error 2)
error: Encountered error: No such file or directory (os error 2)
error: Encountered error: No such file or directory (os error 2)
error: Encountered error: No such file or directory (os error 2)
error: Encountered error: No such file or directory (os error 2)
error: Encountered error: No such file or directory (os error 2)
error: Encountered error: No such file or directory (os error 2)
error: Encountered error: No such file or directory (os error 2)
error: Encountered error: No such file or directory (os error 2)
error: Encountered error: No such file or directory (os error 2)
error: Encountered error: No such file or directory (os error 2)
error: Encountered error: No such file or directory (os error 2)
error: Encountered error: No such file or directory (os error 2)
error: Encountered error: No such file or directory (os error 2)
error: Encountered error: No such file or directory (os error 2)

@MichaReiser

Copy link
Copy Markdown
Member Author

#26798 will solve this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

parser Related to the parser performance Potential performance improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants