You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Reduce marshal and unmarshal overhead
Targeted optimizations to reduce performance overhead introduced by
recent feature additions and the unsafe removal.
Unmarshal:
- parseKeyval: access the node directly in the builder's slice to set
Raw, bypassing NodeAt which triggers a GC write barrier for the
nodes-pointer on every key-value expression.
- Iterator.Next: cache the *nodes slice dereference in a local variable
to avoid repeated pointer-to-slice indirection in the hot loop.
Marshal:
- Guard shouldOmitZero calls with an inlineable options.omitzero check.
shouldOmitZero has inlining cost 1145 (budget 80), so avoiding the
function call when omitzero is not set removes per-field overhead.
- Inline the isNil check in encodeMap. isNil has inlining cost 93
(budget 80), so expanding it at the single hot call site avoids
per-map-entry function call overhead.
Update README benchmarks.
Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
Copy file name to clipboardExpand all lines: README.md
+27-27Lines changed: 27 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -235,40 +235,40 @@ the AST level. See https://pkg.go.dev/github.com/pelletier/go-toml/v2/unstable.
235
235
Execution time speedup compared to other Go TOML libraries:
0 commit comments