Env copy on write - #1405
Open
TristonianJones wants to merge 8 commits into
Open
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%** |
TristonianJones
force-pushed
the
env-copy-on-write
branch
from
August 6, 2026 23:10
9d8d1cc to
aa724f3
Compare
l46kok
reviewed
Aug 7, 2026
Collaborator
Author
|
Done, PTAL. |
l46kok
reviewed
Aug 7, 2026
| if chk != nil { | ||
| // If the type-checker has already been instantiated, then the e.declarations have been | ||
| // validated within the chk instance. | ||
| chkOptsCopy = append(chkOptsCopy, checker.ValidatedDeclarations(chk)) |
Collaborator
There was a problem hiding this comment.
Since this check is now present on initChecker(), I wonder if we should remove this.
The case I'm wondering about is disabling a declaration on an extended child environment:
- baseEnv declares custom function foo
- compiling foo with baseEnv succeeds
- childEnv extends from baseEnv with DisableDeclaration on foo
- comping foo with childEnv should fail here
Collaborator
Author
There was a problem hiding this comment.
Good catch, and yes, it should be removed.
l46kok
approved these changes
Aug 7, 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.
Introduce copy-on-write semantics for checker/env.go
Closes #1398