forked from ferrilab/bitvec
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prepare the
bitvec!
fix for publication
- Loading branch information
Showing
3 changed files
with
42 additions
and
1 deletion.
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 |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
|
||
[package] | ||
name = "bitvec" | ||
version = "0.15.1" | ||
version = "0.15.2" | ||
authors = [ | ||
"myrrlyn <[email protected]>", | ||
] | ||
|
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,31 @@ | ||
/*! Macro construction benchmarks. | ||
This is taken from [issue #28], which noted that the `bitvec![bit; rep]` | ||
expansion was horribly inefficient. | ||
This benchmark crate should be used for all macro performance recording, and | ||
compare the macros against `vec!`. While `vec!` will always be faster, because | ||
`bitvec!` does more work than `vec!`, they should at least be close. | ||
Original performance was 10,000x slower. Performance after the fix for #28 was | ||
within 20ns. | ||
[issue #28]: https://github.com/myrrlyn/bitvec/issues/28 | ||
!*/ | ||
|
||
#![feature(test)] | ||
|
||
extern crate test; | ||
|
||
use test::Bencher; | ||
use bitvec::prelude::*; | ||
|
||
#[bench] | ||
fn bitvec_init(b: &mut Bencher) { | ||
b.iter(|| bitvec![0; 16 * 16 * 9]); | ||
} | ||
|
||
#[bench] | ||
fn vec_init(b: &mut Bencher) { | ||
b.iter(|| vec![0u8; 16 * 16 * 9 / 8]); | ||
} |