-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
optimize
zip_findlast_entry
and add benchmarks (#81)
- Loading branch information
Showing
5 changed files
with
45 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
/.vscode/ | ||
|
||
/test/Manifest.toml | ||
/benchmark/Manifest.toml | ||
/Manifest.toml | ||
fixture.tar.gz | ||
fixture | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[deps] | ||
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf" | ||
Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6" | ||
PkgBenchmark = "32113eaa-f34f-5b0d-bd6c-c81e245fc73d" | ||
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" | ||
ZipArchives = "49080126-0e18-4c2a-b176-c102e4b3760c" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# ZipArchives.jl benchmarks | ||
|
||
This directory contains benchmarks for ZipArchives. To run all the | ||
benchmarks, launch `julia --project=benchmark` and enter: | ||
|
||
``` julia | ||
using PkgBenchmark | ||
import ZipArchives | ||
|
||
benchmarkpkg(ZipArchives) | ||
``` |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using BenchmarkTools | ||
using Random | ||
using ZipArchives | ||
|
||
const SUITE = BenchmarkGroup() | ||
rbench = SUITE["reading"] = BenchmarkGroup() | ||
|
||
sink = IOBuffer() | ||
names = String[] | ||
ZipWriter(sink) do w | ||
for i in 1:2000 | ||
local name = String(rand(UInt8('a'):UInt8('z'), 100)) | ||
push!(names, name) | ||
zip_writefile(w, name, rand(UInt8, 10000)) | ||
end | ||
end | ||
data = take!(sink) | ||
r = ZipReader(data) | ||
|
||
rbench["ZipReader"] = @benchmarkable ZipReader($(data)) | ||
rbench["zip_findlast_entry nothing"] = @benchmarkable zip_findlast_entry($(r), $("abc")) | ||
rbench["zip_findlast_entry first"] = @benchmarkable zip_findlast_entry($(r), $(names[begin])) | ||
rbench["zip_findlast_entry last"] = @benchmarkable zip_findlast_entry($(r), $(names[end])) | ||
rbench["zip_readentry"] = @benchmarkable zip_readentry($(r), $(1000)) |
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