archive: fix order of struct items to reduce memory usage

Found by fieldalignment:
        archive.go:46:14: struct with 88 pointer bytes could be 56
        archive.go:66:18: struct with 24 pointer bytes could be 16

The first one probably doesn't matter that much, there's only like 2 of
those objects that are instantiated at runtime. However, there are many
ArchiveItems (hundreds or more depending on the archives compositions)
This commit is contained in:
Clayton Craft
2023-03-12 20:37:10 -07:00
parent 27e271b904
commit baf76ed614

View File

@@ -44,11 +44,11 @@ const (
)
type Archive struct {
items archiveItems
cpioWriter *cpio.Writer
buf *bytes.Buffer
compress_format CompressFormat
compress_level CompressLevel
items archiveItems
}
func New(format CompressFormat, level CompressLevel) (*Archive, error) {
@@ -64,8 +64,8 @@ func New(format CompressFormat, level CompressLevel) (*Archive, error) {
}
type archiveItem struct {
sourcePath string
header *cpio.Header
sourcePath string
}
type archiveItems struct {