remove Result<> from Blob accessors, add parent (#2608)

* remove Result<> from Blob accessors, add parent
* update chacha's golden
* fixup benches
This commit is contained in:
Rob Walker
2019-01-30 20:18:28 -08:00
committed by GitHub
parent a746969995
commit 1b50fbbc90
13 changed files with 204 additions and 249 deletions

View File

@@ -19,17 +19,17 @@ fn bench_write_blobs(bench: &mut Bencher, blobs: &mut Vec<Blob>, ledger_path: &s
bench.iter(move || {
for blob in blobs.iter_mut() {
let index = blob.index().unwrap();
let index = blob.index();
db_ledger
.put_data_blob_bytes(
blob.slot().unwrap(),
blob.slot(),
index,
&blob.data[..BLOB_HEADER_SIZE + blob.size().unwrap()],
&blob.data[..BLOB_HEADER_SIZE + blob.size()],
)
.unwrap();
blob.set_index(index + num_blobs as u64).unwrap();
blob.set_index(index + num_blobs as u64);
}
});
@@ -50,8 +50,8 @@ fn setup_read_bench(
// Convert the entries to blobs, write the blobs to the ledger
let mut blobs = entries.to_blobs();
for (index, b) in blobs.iter_mut().enumerate() {
b.set_index(index as u64).unwrap();
b.set_slot(slot).unwrap();
b.set_index(index as u64);
b.set_slot(slot);
}
db_ledger
.write_blobs(&blobs)
@@ -67,7 +67,7 @@ fn bench_write_small(bench: &mut Bencher) {
let entries = make_tiny_test_entries(num_entries);
let mut blobs = entries.to_blobs();
for (index, b) in blobs.iter_mut().enumerate() {
b.set_index(index as u64).unwrap();
b.set_index(index as u64);
}
bench_write_blobs(bench, &mut blobs, &ledger_path);
}
@@ -81,7 +81,7 @@ fn bench_write_big(bench: &mut Bencher) {
let entries = make_large_test_entries(num_entries);
let mut blobs = entries.to_blobs();
for (index, b) in blobs.iter_mut().enumerate() {
b.set_index(index as u64).unwrap();
b.set_index(index as u64);
}
bench_write_blobs(bench, &mut blobs, &ledger_path);
@@ -159,8 +159,8 @@ fn bench_insert_data_blob_small(bench: &mut Bencher) {
bench.iter(move || {
for blob in blobs.iter_mut() {
let index = blob.index().unwrap();
blob.set_index(index + num_entries as u64).unwrap();
let index = blob.index();
blob.set_index(index + num_entries as u64);
}
db_ledger.write_blobs(&blobs).unwrap();
});
@@ -181,12 +181,9 @@ fn bench_insert_data_blob_big(bench: &mut Bencher) {
bench.iter(move || {
for blob in shared_blobs.iter_mut() {
let index = blob.read().unwrap().index().unwrap();
let index = blob.read().unwrap().index();
db_ledger.write_shared_blobs(vec![blob.clone()]).unwrap();
blob.write()
.unwrap()
.set_index(index + num_entries as u64)
.unwrap();
blob.write().unwrap().set_index(index + num_entries as u64);
}
});