]> Cypherpunks repositories - gostls13.git/commit
archive/zip: preallocate fileList size for Reader.Open
authorOlivier Mengué <olivier.mengue@gmail.com>
Thu, 6 Mar 2025 18:44:22 +0000 (19:44 +0100)
committerGopher Robot <gobot@golang.org>
Fri, 7 Mar 2025 19:31:30 +0000 (11:31 -0800)
commit812a44ebd0a34ba2985f7f10c451fd210d5bab15
tree8d68ea3cb56fc53ca08307e81756510e9cda03cf
parentfe9b292b11355af6b5f6e1d9247b88fa134657ed
archive/zip: preallocate fileList size for Reader.Open

When building the index of file entries for Reader.Open (when the Reader
is used as an io/fs.FS), reduce reallocations by pre-allocating the
count of entries based on the count of file entries.

Change-Id: I05048337cb5e752054b3e984a8a5ec5199c4589b
Reviewed-on: https://go-review.googlesource.com/c/go/+/655476
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
src/archive/zip/reader.go