[blooms-db] Fix benchmarks (#10974)

* [blooms-db] Fix benchmarks

* Use Bloom::zero()
This commit is contained in:
David 2019-08-15 15:36:07 +02:00 committed by GitHub
parent a23f5b8fd9
commit e50eafe6e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 9 deletions

View File

@ -31,8 +31,8 @@ use ethbloom::Bloom;
fn blooms_filter_1_million_ok(b: &mut Bencher) {
let tempdir = TempDir::new("").unwrap();
let database = Database::open(tempdir.path()).unwrap();
database.insert_blooms(999_999, iter::once(&Bloom::from(0))).unwrap();
let bloom = Bloom::from(0x001);
database.insert_blooms(999_999, iter::once(&Bloom::zero())).unwrap();
let bloom = Bloom::from_low_u64_be(0x001);
database.insert_blooms(200_000, iter::once(&bloom)).unwrap();
database.insert_blooms(400_000, iter::once(&bloom)).unwrap();
database.insert_blooms(600_000, iter::once(&bloom)).unwrap();
@ -48,9 +48,9 @@ fn blooms_filter_1_million_ok(b: &mut Bencher) {
fn blooms_filter_1_million_miss(b: &mut Bencher) {
let tempdir = TempDir::new("").unwrap();
let database = Database::open(tempdir.path()).unwrap();
database.insert_blooms(999_999, iter::once(&Bloom::from(0))).unwrap();
let bloom = Bloom::from(0x001);
let bad_bloom = Bloom::from(0x0001);
database.insert_blooms(999_999, iter::once(&Bloom::zero())).unwrap();
let bloom = Bloom::from_low_u64_be(0x001);
let bad_bloom = Bloom::from_low_u64_be(0x0001);
database.insert_blooms(200_000, iter::once(&bloom)).unwrap();
database.insert_blooms(400_000, iter::once(&bloom)).unwrap();
database.insert_blooms(600_000, iter::once(&bloom)).unwrap();
@ -66,9 +66,9 @@ fn blooms_filter_1_million_miss(b: &mut Bencher) {
fn blooms_filter_1_million_miss_and_ok(b: &mut Bencher) {
let tempdir = TempDir::new("").unwrap();
let database = Database::open(tempdir.path()).unwrap();
database.insert_blooms(999_999, iter::once(&Bloom::from(0))).unwrap();
let bloom = Bloom::from(0x001);
let bad_bloom = Bloom::from(0x0001);
database.insert_blooms(999_999, iter::once(&Bloom::zero())).unwrap();
let bloom = Bloom::from_low_u64_be(0x001);
let bad_bloom = Bloom::from_low_u64_be(0x0001);
database.insert_blooms(200_000, iter::once(&bloom)).unwrap();
database.insert_blooms(400_000, iter::once(&bloom)).unwrap();
database.insert_blooms(600_000, iter::once(&bloom)).unwrap();

View File

@ -19,7 +19,7 @@ use std::path::{Path, PathBuf};
use ethbloom;
use crate::file::{File, FileIterator};
fn other_io_err<E>(e: E) -> io::Error where E: Into<Box<error::Error + Send + Sync>> {
fn other_io_err<E>(e: E) -> io::Error where E: Into<Box<dyn error::Error + Send + Sync>> {
io::Error::new(io::ErrorKind::Other, e)
}