Repository navigation
Avoid reallocating singleton call arguments - #26223
Conversation
Memory usage reportMemory usage unchanged โ |
|
|
Merging this PR will improve performance by 4.43%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| โก | Simulation | parser[pydantic/types.py] |
1.5 ms | 1.4 ms | +4.43% |
Tip
Curious why this is faster? Use the CodSpeed MCP and ask your agent.
Comparing micha/avoid-single-call-argument-reallocation (56bf0b5) with main (c975881)
Footnotes
-
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. โฉ
| let start = self.node_start(); | ||
| self.bump(TokenKind::Lpar); | ||
|
|
||
| if self.eat(TokenKind::Rpar) { |
There was a problem hiding this comment.
This helped mitigate what otherwise was a perf regression
Summary
Reserve exactly one positional-argument slot when a call's first argument is immediately followed by
), avoiding the usual capacity-four allocation and boxed-slice shrink. Singletons are 63.48% of calls with positional arguments across ty's 162-project ecosystem corpus, while multi-argument calls retain their existing allocation path.Test Plan
Testing: Ran the parser test suite, Clippy, and repository hooks.