]> git.feebdaed.xyz Git - 0xmirror/go.git/commit
compress/flate: move big non-pointer arrays to end of compressor
authorIan Lance Taylor <iant@golang.org>
Mon, 29 Sep 2025 04:38:53 +0000 (21:38 -0700)
committerGopher Robot <gobot@golang.org>
Tue, 25 Nov 2025 20:28:05 +0000 (12:28 -0800)
commit8d6d14f5d68c6011eb0ae1c9fac6857475aae7a8
tree6f53753d07063af87e19600fc9038551078dbcf3
parent4ca048cc326bf310f873315dfb1e2644ec243299
compress/flate: move big non-pointer arrays to end of compressor

The compressor type is fairly large: 656616 bytes on amd64.
Before this patch, it had fields of slice and interface type
near the end of the struct. As those types always contain pointers,
the ptrBytes value in the type descriptor was quite large.
That forces the garbage collector to do extra work scanning for pointers,
and wastes a bit of executable space recording the gcmask for the type.

This patch moves the arrays to the end of the type,
fixing those minor issues.

Change-Id: I849a75a19cc61137c8797a1ea5a4c97e0f69b4db
Reviewed-on: https://go-review.googlesource.com/c/go/+/707596
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
src/compress/flate/deflate.go