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
pub mod xtea { | |
const DELTA: u32 = 0x9e3779b9; | |
pub fn encrypt(value: &[u32], key: &[u32]) -> Vec<u32> { | |
// length of input as n for convinience | |
let n = value.len(); | |
if n == 0 { | |
return Vec::new(); |
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
#![feature(sip_hash_13)] | |
use std::time; | |
use std::collections::HashMap; | |
use std::hash::{BuildHasher, BuildHasherDefault}; | |
use std::hash::{SipHasher13, SipHasher24}; | |
type TTTT = u32; | |
fn main() { | |
let a = time::SystemTime::now(); |
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
#![feature(conservative_impl_trait)] | |
extern crate futures; | |
extern crate tokio_core; | |
use std::env; | |
use std::io; | |
use std::net::SocketAddr; | |
use futures::{Future, Poll, Async}; | |
use futures::stream::Stream; |
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
use std::hash::{Hasher, BuildHasherDefault}; | |
use std::collections::HashMap; | |
pub type IdHasherBuilder = BuildHasherDefault<IdHasher>; | |
pub type IdHashMap<K, V> = HashMap<K, V, IdHasherBuilder>; | |
pub struct IdHasher(u64); | |
impl Default for IdHasher { | |
#[inline] | |
fn default() -> IdHasher { |
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
static const uint32_t kGoldenRatioU32 = 0x9E3779B9U; | |
static const uint64_t kGoldenRatioU64 = 0x517cc1b727220a95ULL; | |
inline uint32_t | |
RotateBitsLeft32(uint32_t aValue, uint8_t aBits) | |
{ | |
return (aValue << aBits) | (aValue >> (32 - aBits)); | |
} |
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
➜ hashmap2 git:(layout) ✗ cargo-benchcmp hhkvkv:: orderm:: bench.txt | |
name hhkvkv:: ns/iter orderm:: ns/iter diff ns/iter diff % | |
grow_100_000 820,736 470,797 -349,939 -42.64% | |
grow_10_000 819,471 468,147 -351,324 -42.87% | |
grow_big_value_100_000 19,868,651 7,103,663 -12,764,988 -64.25% | |
grow_big_value_10_000 1,747,976 556,252 -1,191,724 -68.18% | |
grow_fnv_10_000 411,256 296,907 -114,349 -27.80% | |
insert_100 2,315 2,286 -29 -1.25% | |
insert_1000 22,907 23,622 715 3.12% | |
insert_100_000 4,266,405 2,726,115 -1,540,290 -36.10% |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
#![feature(global_allocator, test)] | |
extern crate jemallocator; | |
#[global_allocator] | |
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc; | |
extern crate jemalloc_sys; | |
fn main() { unsafe { | |
let ptr = jemalloc_sys::mallocx(100, 0); | |
let rsz1 = sallocx(ptr as usize, 0); |