this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

internal/core/convert: avoid reflect.Value.Seq2 on maps too

│ old │ new │
│ B/op │ B/op vs base │
VetInventory 4.752Gi ± ∞ ¹ 4.725Gi ± ∞ ¹ -0.57% (p=1.000 n=1)

│ old │ new │
│ allocs/op │ allocs/op vs base │
VetInventory 52.86M ± ∞ ¹ 51.05M ± ∞ ¹ -3.43% (p=1.000 n=1)

Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
Change-Id: Ic4d07f104c95651c0dc14db1931f8bff124c6f5b
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1229423
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
Reviewed-by: Matthew Sackman <matthew@cue.works>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>

+5 -1
+5 -1
internal/core/convert/go.go
··· 431 431 case reflect.String, reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, 432 432 reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: 433 433 434 - for k, val := range val.Seq2() { 434 + // Note that we don't use [reflect.Value.Seq2]; see the note below for [reflect.Array]. 435 + iter := val.MapRange() 436 + for iter.Next() { 437 + k, val := iter.Key(), iter.Value() 435 438 sub := fromGoValue(ctx, nilIsTop, val) 436 439 // mimic behavior of encoding/json: report error of unsupported type. 437 440 if sub == nil { ··· 484 487 // Note that we don't use [reflect.Value.Seq2], 485 488 // as it allocates more per iteration, and we don't need the index value. 486 489 // We can't use [reflect.Value.Seq] either, as that's just the indices. 490 + // See the upstream bug report: https://go.dev/issue/76357 487 491 for i := range numElems { 488 492 val := val.Index(i) 489 493 x := fromGoValue(ctx, nilIsTop, val)