Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal/core/adt: don't allocate when asserting in Environment.up
Assertf takes remaining formatting arguments as ..any, and since the arguments we pass here are two integers, they escape when a pointer to them is needed to fit into an interface. Environment.up is called often, so this resulted in about 4.6% of the total allocated objects in `cue vet -c=false ./...`. The small amount of added debug info doesn't seem worth a 2% CPU cost. We could likely write the assertion in a way that doesn't escape values, but that also doesn't seem worth the hassle right now. │ old │ new │ │ sec/op │ sec/op vs base │ CueVetAll 1.968 ± 1% 1.929 ± 1% -1.97% (p=0.000 n=10) Signed-off-by: Daniel Martí <[email protected]> Change-Id: I9334b91ed41f36d7e755504d37d49a9430c4a174 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1194375 TryBot-Result: CUEcueckoo <[email protected]> Unity-Result: CUE porcuepine <[email protected]> Reviewed-by: Marcel van Lohuizen <[email protected]>
- Loading branch information