[blooms-db] Fix benchmarks (#10974)
* [blooms-db] Fix benchmarks * Use Bloom::zero()
This commit is contained in:
parent
a23f5b8fd9
commit
e50eafe6e1
@ -31,8 +31,8 @@ use ethbloom::Bloom;
|
|||||||
fn blooms_filter_1_million_ok(b: &mut Bencher) {
|
fn blooms_filter_1_million_ok(b: &mut Bencher) {
|
||||||
let tempdir = TempDir::new("").unwrap();
|
let tempdir = TempDir::new("").unwrap();
|
||||||
let database = Database::open(tempdir.path()).unwrap();
|
let database = Database::open(tempdir.path()).unwrap();
|
||||||
database.insert_blooms(999_999, iter::once(&Bloom::from(0))).unwrap();
|
database.insert_blooms(999_999, iter::once(&Bloom::zero())).unwrap();
|
||||||
let bloom = Bloom::from(0x001);
|
let bloom = Bloom::from_low_u64_be(0x001);
|
||||||
database.insert_blooms(200_000, iter::once(&bloom)).unwrap();
|
database.insert_blooms(200_000, iter::once(&bloom)).unwrap();
|
||||||
database.insert_blooms(400_000, iter::once(&bloom)).unwrap();
|
database.insert_blooms(400_000, iter::once(&bloom)).unwrap();
|
||||||
database.insert_blooms(600_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) {
|
fn blooms_filter_1_million_miss(b: &mut Bencher) {
|
||||||
let tempdir = TempDir::new("").unwrap();
|
let tempdir = TempDir::new("").unwrap();
|
||||||
let database = Database::open(tempdir.path()).unwrap();
|
let database = Database::open(tempdir.path()).unwrap();
|
||||||
database.insert_blooms(999_999, iter::once(&Bloom::from(0))).unwrap();
|
database.insert_blooms(999_999, iter::once(&Bloom::zero())).unwrap();
|
||||||
let bloom = Bloom::from(0x001);
|
let bloom = Bloom::from_low_u64_be(0x001);
|
||||||
let bad_bloom = Bloom::from(0x0001);
|
let bad_bloom = Bloom::from_low_u64_be(0x0001);
|
||||||
database.insert_blooms(200_000, iter::once(&bloom)).unwrap();
|
database.insert_blooms(200_000, iter::once(&bloom)).unwrap();
|
||||||
database.insert_blooms(400_000, iter::once(&bloom)).unwrap();
|
database.insert_blooms(400_000, iter::once(&bloom)).unwrap();
|
||||||
database.insert_blooms(600_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) {
|
fn blooms_filter_1_million_miss_and_ok(b: &mut Bencher) {
|
||||||
let tempdir = TempDir::new("").unwrap();
|
let tempdir = TempDir::new("").unwrap();
|
||||||
let database = Database::open(tempdir.path()).unwrap();
|
let database = Database::open(tempdir.path()).unwrap();
|
||||||
database.insert_blooms(999_999, iter::once(&Bloom::from(0))).unwrap();
|
database.insert_blooms(999_999, iter::once(&Bloom::zero())).unwrap();
|
||||||
let bloom = Bloom::from(0x001);
|
let bloom = Bloom::from_low_u64_be(0x001);
|
||||||
let bad_bloom = Bloom::from(0x0001);
|
let bad_bloom = Bloom::from_low_u64_be(0x0001);
|
||||||
database.insert_blooms(200_000, iter::once(&bloom)).unwrap();
|
database.insert_blooms(200_000, iter::once(&bloom)).unwrap();
|
||||||
database.insert_blooms(400_000, iter::once(&bloom)).unwrap();
|
database.insert_blooms(400_000, iter::once(&bloom)).unwrap();
|
||||||
database.insert_blooms(600_000, iter::once(&bloom)).unwrap();
|
database.insert_blooms(600_000, iter::once(&bloom)).unwrap();
|
||||||
|
@ -19,7 +19,7 @@ use std::path::{Path, PathBuf};
|
|||||||
use ethbloom;
|
use ethbloom;
|
||||||
use crate::file::{File, FileIterator};
|
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)
|
io::Error::new(io::ErrorKind::Other, e)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user