Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use {
const VEC_SIZE: usize = 16;
const SPILLED_SIZE: usize = 100;

trait Vector<T>: for<'a> From<&'a [T]> + Extend<T> {
trait Vector<T>: for<'a> From<&'a [T]> + Extend<T> + FromIterator<T> {
fn new() -> Self;
fn push(&mut self, val: T);
fn pop(&mut self) -> Option<T>;
Expand Down Expand Up @@ -280,7 +280,7 @@ fn gen_extend_filtered<V: Vector<u64>>(n: u64, b: &mut Bencher) {
fn gen_from_iter<V: Vector<u64>>(n: u64, b: &mut Bencher) {
let v: Vec<u64> = (0..black_box(n)).collect();
b.iter(|| {
let vec = V::from(black_box(&v));
let vec: V = black_box(&v).iter().copied().collect();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should pretty much be the same but I guess it doesn't really matter

black_box(vec)
});
}
Expand Down Expand Up @@ -328,7 +328,7 @@ fn gen_from_elem<V: Vector<u64>>(n: usize, b: &mut Bencher) {

fn gen_retain_mut_half<V: Vector<u64>>(n: usize, b: &mut Bencher) {
b.iter_with_setup(
|| V::from_elem(16, black_box(n)),
|| (0..black_box(n) as u64).collect::<V>(),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that makes much more sense

|mut vec| {
vec.retain_mut(|x| black_box(*x) % 2 == 0);
vec
Expand Down