Skip to content

Commit e335f81

Browse files
committed
chore: update changelog and fix lint warnings
- Add all v6 performance optimizations to CHANGELOG.md - Remove unused nilableType function (unusedfunc warning) - Remove tautological if-err-nil check in intern.go (nilness warning)
1 parent 5f6d4fe commit e335f81

3 files changed

Lines changed: 13 additions & 11 deletions

File tree

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@
88
- **encode:** `byteSliceWriter` for `Marshal()` path — native `WriteByte` implementation eliminates per-byte heap allocation
99
- **encode:** `byteWriter.WriteByte` scratch fix for streaming path — uses `[1]byte` scratch instead of allocating `[]byte{c}`
1010
- **encode:** `Encode()` fast paths for `map[string]interface{}` and `[]interface{}` — bypasses `reflect.ValueOf` + sync.Map encoder lookup
11+
- **encode:** `MarshalAppend(dst, v)` API — appends encoded bytes to caller-provided buffer, eliminating the final `make+copy` in `Marshal()` (-26% faster, -94% less memory for callers who reuse buffers)
12+
- **encode:** two-pass `OmitEmpty` — avoids slice allocation when no fields are omitted (common case for time-series data)
13+
- **encode:** cache `isZeroer` interface check — pre-computes at struct-discovery time to skip `v.Interface()` boxing during `OmitEmpty` checks
14+
- **encode/decode:** skip `reflect.Convert` for exact map/slice types — adds `v.Type() == targetType` fast path before `Convert()` for `map[string]string`, `map[string]bool`, `map[string]interface{}`, and `[]string` (-7–8% faster)
15+
- **encode:** `map[string]string` fast path in `Encode()` type switch — bypasses `reflect.ValueOf` + encoder lookup (-15% faster)
16+
- **decode:** replace goroutine-per-type `cachedValues` with `sync.Pool` — eliminates goroutine leak and channel synchronization overhead
17+
- **encode:** pool sorted map key slices via `sync.Pool` — eliminates 1 alloc per sorted map encode for `SetSortMapKeys(true)` callers
18+
- **decode:** pool recording buffer in `unmarshalValue` — eliminates 1 alloc per `Unmarshaler.UnmarshalMsgpack` call
19+
- **decode:** inline `hasNilCode` for byte-slice reader path — peeks directly at underlying data, avoiding two interface method calls per nil check (-2–4% faster decode)
1120

1221
### Bug Fixes
1322

@@ -34,6 +43,8 @@
3443
- Bump `go.mod` to Go 1.26
3544
- CI: add `-count=1 -timeout=5m` and `GOGC=50` to race tests to prevent OOM on runners ([#33](https://github.com/Basekick-Labs/msgpack/issues/33))
3645
- CI: change cross-platform step from `go test` to `go vet` (compile-only)
46+
- Remove tautological `if err != nil` in `decodeInternedInterfaceValue` (nilness warning)
47+
- Remove unused `nilableType` function from `encode_value.go`
3748

3849
---
3950

encode_value.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -207,13 +207,6 @@ func nilable(kind reflect.Kind) bool {
207207
return false
208208
}
209209

210-
func nilableType(t reflect.Type) bool {
211-
if t.Kind() == reflect.Ptr {
212-
t = t.Elem()
213-
}
214-
return nilable(t.Kind())
215-
}
216-
217210
//------------------------------------------------------------------------------
218211

219212
func marshalBinaryValueAddr(e *Encoder, v reflect.Value) error {

intern.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,8 @@ func decodeInternedInterfaceValue(d *Decoder, v reflect.Value) error {
105105
v.Set(reflect.ValueOf(s))
106106
return nil
107107
}
108-
if err != nil {
109-
if _, ok := err.(unexpectedCodeError); !ok {
110-
return err
111-
}
108+
if _, ok := err.(unexpectedCodeError); !ok {
109+
return err
112110
}
113111

114112
if err := d.s.UnreadByte(); err != nil {

0 commit comments

Comments
 (0)