Skip to content

Commit ff1302f

Browse files
committed
fix: reorder fieldInfo struct to reduce padding
1 parent d8e9cd2 commit ff1302f

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

pkg/encoding/kvunmarshal.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ func (k *KVScanner) Unmarshal(v any) error {
4343

4444
// Build a slice of field info to avoid string allocations during lookup
4545
type fieldInfo struct {
46-
keyStr string // cached for NameEquals and error messages
47-
fieldIdx int
4846
field reflect.Value // cached to avoid repeated rv.Field() calls
49-
fieldKind reflect.Kind // cached to avoid repeated Kind() calls
50-
isPointer bool // cached to avoid repeated checks
47+
keyStr string // cached for NameEquals and error messages
48+
fieldIdx int
49+
fieldKind reflect.Kind // cached to avoid repeated Kind() calls
50+
isPointer bool // cached to avoid repeated checks
5151
}
5252
fields := make([]fieldInfo, 0, rt.NumField())
5353
pointerFieldIndices := make([]int, 0, rt.NumField()) // track pointer field indices for final cleanup

0 commit comments

Comments
 (0)