Go Perf Strings Bytes Zerocopy

Guides zero-copy string and []byte work in Go — strings.Builder (one Grow) vs += in a loop (quadratic), strconv.Append* vs allocating fmt.Sprintf, a pooled bytes.Buffer+Reset, []byte less than - greater than string conversion cost plus compiler no-copy cases (m[string(b)], comparison, range), and unsafe.String/unsafe.Slice (1.20) zero-copy with safety rules. Auto-invokes on "avoid string allocation", "[]byte to string without copy", "strconv vs fmt", "unsafe.String". Routes rune correctness to go-strings-bytes-runes, pooling to go-perf-sync-pool.

ctoth Updated 1 repo stars

File contents

ctoth/golang-skills-plugin commit cc7f626d9f

Frequently asked questions

npx get-skill add ctoth/go-perf-strings-bytes-zerocopy