Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(partially fix incoming) More hash function simplification #3425

Merged
merged 1 commit into from
Sep 8, 2012
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/test/bench/core-std.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ fn read_line() {
fn str_set() {
let r = rand::Rng();

let s = map::hashmap(str::hash, str::eq);
let s = map::hashmap();

for int::range(0, 1000) |_i| {
map::set_add(s, r.gen_str(10));
Expand Down
6 changes: 2 additions & 4 deletions src/test/bench/graph500-bfs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,9 @@ fn make_edges(scale: uint, edgefactor: uint) -> ~[(node_id, node_id)] {
}
}

pure fn node_hash(n: &node_id) -> uint { *n as uint }

fn make_graph(N: uint, edges: ~[(node_id, node_id)]) -> graph {
let graph = do vec::from_fn(N) |_i| {
map::hashmap::<node_id, ()>(node_hash, sys::shape_eq)
map::hashmap::<node_id, ()>()
};

do vec::each(edges) |e| {
Expand All @@ -87,7 +85,7 @@ fn make_graph(N: uint, edges: ~[(node_id, node_id)]) -> graph {
}

fn gen_search_keys(graph: graph, n: uint) -> ~[node_id] {
let keys = map::hashmap::<node_id, ()>(node_hash, sys::shape_eq);
let keys = map::hashmap::<node_id, ()>();
let r = rand::Rng();

while keys.size() < n {
Expand Down
14 changes: 4 additions & 10 deletions src/test/bench/task-perf-word-count-generic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,6 @@ trait hash_key {
pure fn eq(&&k: self) -> bool;
}

fn mk_hash<K: Const hash_key, V: Copy>() -> map::hashmap<K, V> {
pure fn hashfn<K: Const hash_key>(k: &K) -> uint { k.hash() }
pure fn hasheq<K: Const hash_key>(k1: &K, k2: &K) -> bool { k1.eq(*k2) }

map::hashmap(hashfn, hasheq)
}

impl ~str: hash_key {
pure fn hash() -> uint { str::hash(&self) }
pure fn eq(&&x: ~str) -> bool { self == x }
Expand Down Expand Up @@ -175,11 +168,12 @@ mod map_reduce {
input: K1)
{
// log(error, "map_task " + input);
let intermediates = mk_hash();
let intermediates = map::hashmap();

do map(input) |key, val| {
let mut c = None;
match intermediates.find(key) {
let found = intermediates.find(key);
match found {
Some(_c) => { c = Some(_c); }
None => {
do ctrl.swap |ctrl| {
Expand Down Expand Up @@ -251,7 +245,7 @@ mod map_reduce {
// This task becomes the master control task. It task::_spawns
// to do the rest.

let reducers = mk_hash();
let reducers = map::hashmap();
let mut tasks = start_mappers(map, ctrl, inputs);
let mut num_mappers = vec::len(inputs) as int;

Expand Down