-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- initial sketch of lexicographic trie for pipelining - move path splitting into a submodule - lex trie can now propagate entry data - outline handle allocation - mostly handle files - mostly handle dirs - clarify symlink FIXMEs - do symlink validation - extract writable dir setting to helper method - modify args to handle allocation method - handle allocation test passes - simplify perms a lot - outline evaluation - handle symlinks - BIGGER CHANGE! add EntryReader/etc - make initial pipelined extract work - fix file perms by writing them after finishing the file write - support directory entries by unix mode as well - impl split extraction - remove dependency on reader refactoring
- Loading branch information
1 parent
8656826
commit 7fbe408
Showing
7 changed files
with
2,496 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
use bencher::{benchmark_group, benchmark_main}; | ||
|
||
use bencher::Bencher; | ||
use tempdir::TempDir; | ||
|
||
use std::fs; | ||
use std::path::Path; | ||
|
||
use zip::result::ZipResult; | ||
use zip::ZipArchive; | ||
|
||
#[cfg(all(feature = "parallelism", unix))] | ||
use zip::read::{split_extract, ExtractionParameters}; | ||
|
||
/* This archive has a set of entries repeated 20x: | ||
* - 200K random data, stored uncompressed (CompressionMethod::Stored) | ||
* - 246K text data (the project gutenberg html version of king lear) | ||
* (CompressionMethod::Bzip2, compression level 1) (project gutenberg ebooks are public domain) | ||
* | ||
* The full archive file is 5.3MB. | ||
*/ | ||
fn get_test_archive() -> ZipResult<ZipArchive<fs::File>> { | ||
let path = | ||
Path::new(env!("CARGO_MANIFEST_DIR")).join("tests/data/stored-and-compressed-text.zip"); | ||
let file = fs::File::open(path)?; | ||
ZipArchive::new(file) | ||
} | ||
|
||
fn extract_basic(bench: &mut Bencher) { | ||
let mut readable_archive = get_test_archive().unwrap(); | ||
let total_size: u64 = readable_archive | ||
.decompressed_size() | ||
.unwrap() | ||
.try_into() | ||
.unwrap(); | ||
|
||
let parent = TempDir::new("zip-extract").unwrap(); | ||
|
||
bench.bytes = total_size; | ||
bench.bench_n(1, |bench| { | ||
bench.iter(move || { | ||
let outdir = TempDir::new_in(parent.path(), "bench-subdir") | ||
.unwrap() | ||
.into_path(); | ||
readable_archive.extract(outdir).unwrap(); | ||
}); | ||
}); | ||
} | ||
|
||
#[cfg(all(feature = "parallelism", unix))] | ||
const DECOMPRESSION_THREADS: usize = 8; | ||
|
||
#[cfg(all(feature = "parallelism", unix))] | ||
fn extract_split(bench: &mut Bencher) { | ||
let readable_archive = get_test_archive().unwrap(); | ||
let total_size: u64 = readable_archive | ||
.decompressed_size() | ||
.unwrap() | ||
.try_into() | ||
.unwrap(); | ||
|
||
let params = ExtractionParameters { | ||
decompression_threads: DECOMPRESSION_THREADS, | ||
..Default::default() | ||
}; | ||
|
||
let parent = TempDir::new("zip-extract").unwrap(); | ||
|
||
bench.bytes = total_size; | ||
bench.bench_n(1, |bench| { | ||
bench.iter(move || { | ||
let outdir = TempDir::new_in(parent.path(), "bench-subdir") | ||
.unwrap() | ||
.into_path(); | ||
split_extract(&readable_archive, &outdir, params.clone()).unwrap(); | ||
}); | ||
}); | ||
} | ||
|
||
#[cfg(not(all(feature = "parallelism", unix)))] | ||
benchmark_group!(benches, extract_basic); | ||
|
||
#[cfg(all(feature = "parallelism", unix))] | ||
benchmark_group!(benches, extract_basic, extract_split); | ||
|
||
benchmark_main!(benches); |
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.