Full details over at https://cue.gerrithub.io/c/cue-lang/cue/+/1231138. In summary, a diff like
- iter := val.MapRange()
- for iter.Next() {
- k, val := iter.Key(), iter.Value()
+ for k, val := range val.Seq2() {
is causing an increase in allocs:
│ old │ new │
│ B/op │ B/op vs base │
VetBuiltins 136.0Mi ± 0% 137.5Mi ± 0% +1.12% (p=0.000 n=8)
│ old │ new │
│ allocs/op │ allocs/op vs base │
VetBuiltins 1.264M ± 0% 1.364M ± 0% +7.91% (p=0.000 n=8)
which doesn't make sense to me, and sounds like some sort of reflect or compiler bug.
I got these numbers with go version go1.27-devel_a430bc1bd7 2026-02-10 21:27:59 -0800 linux/amd64, but I'm sure this also reproduces on 1.26.0, as I originally discovered this issue weeks ago and worked around it in https://cue.gerrithub.io/c/cue-lang/cue/+/1229423.
Note that #76357 is related but not a duplicate; that is about a use case where new API is probably needed to be efficient for arrays and slices. This issue should not require new API at all.
Full details over at https://cue.gerrithub.io/c/cue-lang/cue/+/1231138. In summary, a diff like
is causing an increase in allocs:
which doesn't make sense to me, and sounds like some sort of reflect or compiler bug.
I got these numbers with
go version go1.27-devel_a430bc1bd7 2026-02-10 21:27:59 -0800 linux/amd64, but I'm sure this also reproduces on 1.26.0, as I originally discovered this issue weeks ago and worked around it in https://cue.gerrithub.io/c/cue-lang/cue/+/1229423.Note that #76357 is related but not a duplicate; that is about a use case where new API is probably needed to be efficient for arrays and slices. This issue should not require new API at all.