This repository was archived by the owner on Jun 30, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
jar: share decoding buffer across files in checkJAR
This purpose of this change is to reduce allocations in checkJAR by sharing a zip decoding buffer across files in a JAR instead of fully decoding each file into its own byte slice. A consequence of this change is that the buffer is fixed size, so the matches* functions cannot operate on byte slices as they once did. Instead, they need to operate on an io.Reader. So, this change also refactors class file scanning into its own method, and rewrites the match functionality in terms of rsc.io/binaryregexp. The performance delta of this change on BenchmarkParse is: name old time/op new time/op delta Parse-16 156µs ± 1% 38µs ± 1% -75.77% (p=0.000 n=9+10) ParseParallel-16 49.7µs ± 8% 14.1µs ± 8% -71.68% (p=0.000 n=10+10) name old alloc/op new alloc/op delta Parse-16 52.2kB ± 0% 18.1kB ± 0% -65.31% (p=0.000 n=10+10) ParseParallel-16 52.8kB ± 0% 18.4kB ± 0% -65.04% (p=0.000 n=10+10) name old allocs/op new allocs/op delta Parse-16 112 ± 0% 54 ± 0% -51.79% (p=0.000 n=10+10) ParseParallel-16 112 ± 0% 54 ± 0% -51.79% (p=0.000 n=10+10)
- Loading branch information
1 parent
96b3273
commit eb36a17
Showing
4 changed files
with
298 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.