-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from contain-rs/v0.7.0
Release version 0.7.0; include tiny maintentance
- Loading branch information
Showing
6 changed files
with
78 additions
and
68 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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "bit-set" | ||
version = "0.6.0" | ||
version = "0.7.0" | ||
authors = ["Alexis Beingessner <[email protected]>"] | ||
license = "Apache-2.0 OR MIT" | ||
description = "A set of bits" | ||
|
@@ -9,6 +9,7 @@ homepage = "https://github.com/contain-rs/bit-set" | |
documentation = "https://docs.rs/bit-set/" | ||
keywords = ["data-structures", "bitset"] | ||
readme = "README.md" | ||
edition = "2015" | ||
|
||
[dependencies] | ||
serde = { version = "1.0", features = ["derive"], optional = true } | ||
|
@@ -25,4 +26,3 @@ serde_json = "1.0" | |
default = ["std"] | ||
std = ["bit-vec/std"] | ||
serde = ["dep:serde", "bit-vec/serde"] | ||
bench = [] |
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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
Version 0.7.0 (not yet released) | ||
========================== | ||
Version 0.7.0 (not yet released) (ZERO BREAKING CHANGES) | ||
======================================================== | ||
|
||
<a id="v0.7.0"></a> | ||
|
||
- `serde::Serialize`, `Deserialize` is derived under the `serde` optional feature | ||
- `impl Display` is implemented | ||
- `impl Debug` has different output | ||
- `impl Debug` has different output (we do not promise stable `Debug` output) | ||
- `fn truncate` is implemented | ||
- `fn get_mut` is implemented |
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,65 @@ | ||
// Copyright 2012-2024 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
#![feature(test)] | ||
|
||
extern crate bit_set; | ||
extern crate bit_vec; | ||
extern crate rand; | ||
extern crate test; | ||
|
||
use bit_set::BitSet; | ||
use bit_vec::BitVec; | ||
use rand::{rngs::ThreadRng, thread_rng, RngCore}; | ||
|
||
use test::{black_box, Bencher}; | ||
|
||
const BENCH_BITS: usize = 1 << 14; | ||
const BITS: usize = 32; | ||
|
||
fn rng() -> ThreadRng { | ||
thread_rng() | ||
} | ||
|
||
#[bench] | ||
fn bench_bit_vecset_small(b: &mut Bencher) { | ||
let mut r = rng(); | ||
let mut bit_vec = BitSet::new(); | ||
b.iter(|| { | ||
for _ in 0..100 { | ||
bit_vec.insert((r.next_u32() as usize) % BITS); | ||
} | ||
black_box(&bit_vec); | ||
}); | ||
} | ||
|
||
#[bench] | ||
fn bench_bit_vecset_big(b: &mut Bencher) { | ||
let mut r = rng(); | ||
let mut bit_vec = BitSet::new(); | ||
b.iter(|| { | ||
for _ in 0..100 { | ||
bit_vec.insert((r.next_u32() as usize) % BENCH_BITS); | ||
} | ||
black_box(&bit_vec); | ||
}); | ||
} | ||
|
||
#[bench] | ||
fn bench_bit_vecset_iter(b: &mut Bencher) { | ||
let bit_vec = BitSet::from_bit_vec(BitVec::from_fn(BENCH_BITS, |idx| idx % 3 == 0)); | ||
b.iter(|| { | ||
let mut sum = 0; | ||
for idx in &bit_vec { | ||
sum += idx as usize; | ||
} | ||
sum | ||
}) | ||
} |
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