Program plan optimizations - #1399
Merged
TristonianJones merged 3 commits intoAug 5, 2026
Merged
Conversation
| Benchmark Case | Before (ns/op) | After (ns/op) | Δ Time | Before (B/op) | After (B/op) | Δ Memory | Before (allocs) | After (allocs) | Δ Allocs | | :--- | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | | BenchmarkProgramPlan/Default | 8,153 | 930 | **-88.6%** | 8,320 | 1,416 | **-83.0%** | 36 | 26 | **-27.8%** | | BenchmarkProgramPlan/OptimizeUnneeded | 7,344 | 1,150 | **-84.3%** | 8,784 | 1,512 | **-82.8%** | 50 | 32 | **-36.0%** | | BenchmarkProgramPlan/OptimizeNeeded | 8,370 | 2,164 | **-74.1%** | 10,224 | 2,976 | **-70.9%** | 67 | 52 | **-22.4%** |
Collaborator
Author
|
@jpbetz FYI |
jpbetz
reviewed
Aug 3, 2026
jpbetz
left a comment
Contributor
There was a problem hiding this comment.
LGTM, this looks like a cleaner/simpler approach than I had considered. Thanks!
TristonianJones
force-pushed
the
dispatcher-reuse
branch
from
August 3, 2026 21:41
6fef02e to
3158098
Compare
Collaborator
Author
|
@jpbetz I went ahead and folded in more of the changes from your proposed PR. The numbers I see are close to what you observed: There's two more changes to make to reduce the |
Contributor
|
Awesome. This LGTM |
jnthntatum
approved these changes
Aug 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A significant amount of overhead comes from the instantiation of the dispatcher
with an immutable set of functions. Instead of recreating the dispatcher, create
a shared one across program instances.
Additionally, check whether optimizations are needed for an expression before
applying them as decorators.
Addresses the dispatcher-sharing proposed in #1397, which is the first half of the optimizations suggested to minimize startup costs.