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:
@@ -44,11 +44,11 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Archive struct {
|
type Archive struct {
|
||||||
items archiveItems
|
|
||||||
cpioWriter *cpio.Writer
|
cpioWriter *cpio.Writer
|
||||||
buf *bytes.Buffer
|
buf *bytes.Buffer
|
||||||
compress_format CompressFormat
|
compress_format CompressFormat
|
||||||
compress_level CompressLevel
|
compress_level CompressLevel
|
||||||
|
items archiveItems
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(format CompressFormat, level CompressLevel) (*Archive, error) {
|
func New(format CompressFormat, level CompressLevel) (*Archive, error) {
|
||||||
@@ -64,8 +64,8 @@ func New(format CompressFormat, level CompressLevel) (*Archive, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type archiveItem struct {
|
type archiveItem struct {
|
||||||
sourcePath string
|
|
||||||
header *cpio.Header
|
header *cpio.Header
|
||||||
|
sourcePath string
|
||||||
}
|
}
|
||||||
|
|
||||||
type archiveItems struct {
|
type archiveItems struct {
|
||||||
|
Reference in New Issue
Block a user