Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
This PR (HEAD: 3862300) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/go/+/762301. Important tips:
|
|
Message from Gopher Robot: Patch Set 1: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/762301. |
|
Message from Gopher Robot: Patch Set 1: Congratulations on opening your first change. Thank you for your contribution! Next steps: Most changes in the Go project go through a few rounds of revision. This can be During May-July and Nov-Jan the Go project is in a code freeze, during which Please don’t reply on this GitHub thread. Visit golang.org/cl/762301. |
|
Message from Ian Lance Taylor: Patch Set 1: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/762301. |
archive/zip.Reader在第一次通过Open/ReadDir以fs.FS方式访问归档时,会先构建一份文件索引。原来的实现会把 ZIP 中每个条目的隐式父目录都提前补齐,再把这些目录和真实文件一起排序。在目录层级很深、条目很多的归档上,初始化时损耗的资源会变得很高。很多时间都花在构造和整理这些中间目录上,而不是花在真正的查找上。
这次调整优化了如下几条:
Open命中一个未显式存在的目录时,再根据前缀判断它是否是一个隐式目录ReadDir枚举目录时,再按前缀整理当前层级的直接子项这样做之后,
Reader不需要在第一次访问时把整棵中间目录树先拼出来,尤其能避免深层路径场景下的大量重复工作。