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
jason@mintyfresh ~/rdev/rloop/src $ rustc --version | |
rustc 1.3.0-dev (5e6b53436 2015-07-24) | |
jason@mintyfresh ~/rdev/rloop/src $ cargo bench --verbose | |
Fresh rloop v0.1.0 (file:///home/jason/rdev/rloop) | |
Running `/home/jason/rdev/rloop/target/release/rloop-30eefaffa210e640 --bench` | |
running 16 tests | |
test extend1 ... bench: 1,043 ns/iter (+/- 79) | |
test extend2 ... bench: 1,049 ns/iter (+/- 60) | |
test extend_vecdeque1 ... bench: 1,069 ns/iter (+/- 10) |
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
#[derive(Debug)] | |
enum List<T,L> { | |
Null(T), | |
Cell(T,L), | |
} | |
use List::*; | |
type Nil<T> = List<T,()>; | |
type Single<T> = List<T,Nil<T>>; |
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
macro_rules! avg { | |
($($t:expr),*) => (sum!($($t),*)/count!($($t),*)); | |
} | |
macro_rules! count { | |
($h:expr) => (1); | |
($h:expr, $($t:expr),*) => | |
(1 + count!($($t),*)); | |
} |
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
// compile as: | |
// gcc -DCLSIZE=64 -O2 -c cl.c -o cl | |
// replace 64 with whatever value you want to pad to. | |
// this bash loop can be helpful: | |
// for x in 8 16 32 64 128 256; do gcc -DCLSIZE=${x} -O2 cl.c -o cl; ./cl; done | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdint.h> | |
#include <threads.h> | |
#include <stdatomic.h> |