perf: avoid type checks in memo and field lookups - #1174
Conversation
✅ Deploy Preview for salsa-rs canceled.
|
Merging this PR will degrade performance by 9.6%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | WallTime | parallel_fast_path[NoEviction] |
361.3 µs | 419.9 µs | -13.96% |
| ❌ | WallTime | project_check_then_incremental[NoEviction] |
6.1 ms | 6.8 ms | -11.11% |
| ❌ | WallTime | parallel_fast_path[Lru] |
3.8 ms | 4.2 ms | -9.87% |
| ❌ | WallTime | project_check_then_incremental[Lru] |
10 ms | 10.9 ms | -8.75% |
| ❌ | WallTime | scan_resistance[NoEviction] |
836.8 µs | 872 µs | -4.03% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing MichaReiser:optimize-memo-lookup (1ff4965) with master (25ed9d3)
Footnotes
-
1 benchmark was skipped, so the baseline result was used instead. If it was deleted from the codebase, click here and archive it to remove it from the performance reports. ↩
|
This is cool but I don't think codex's reasoning here is safe. The issue is that |
ae9fb41 to
4b76b1d
Compare
6d04b76 to
e16c18e
Compare
7045e87 to
1ff4965
Compare
Memo and field lookups repeated TypeId checks even though the database-bound ingredient fixes the accessed type. Bind each ingredient to its database context and acquire thread-local state only for operations that need it.
Fixed hot memo hits drop from 233 to 228 instructions (-2.15%), untracked tracked-struct field bodies drop from 59 to 58, CodSpeed reports a 6.76% aggregate improvement, and ty's 29-case suite improves by 0.145% weighted overall.
Testing: Full target, manual-registration, lint, and performance suites passed.