diff options
| author | Eric Holk <eric.holk@gmail.com> | 2012-05-30 15:32:19 -0700 |
|---|---|---|
| committer | Eric Holk <eric.holk@gmail.com> | 2012-05-30 17:39:53 -0700 |
| commit | 58fdbdc4ef7cee014775bafff23830900fcaf3ca (patch) | |
| tree | b4ceb9b62d1864e145df7cacf481ed642f605fdc /src | |
| parent | f0c345841ce14f6ce618d1ed09c1d728bd253c87 (diff) | |
| download | rust-58fdbdc4ef7cee014775bafff23830900fcaf3ca.tar.gz rust-58fdbdc4ef7cee014775bafff23830900fcaf3ca.zip | |
Avoid some more copies.
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/bench/graph500-bfs.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/test/bench/graph500-bfs.rs b/src/test/bench/graph500-bfs.rs index 577d6bec155..56f764bf4d5 100644 --- a/src/test/bench/graph500-bfs.rs +++ b/src/test/bench/graph500-bfs.rs @@ -199,7 +199,7 @@ fn bfs2(graph: graph, key: node_id) -> bfs_result { } #[doc="A parallel version of the bfs function."] -fn pbfs(graph: graph, key: node_id) -> bfs_result { +fn pbfs(&&graph: arc::arc<graph>, key: node_id) -> bfs_result { // This works by doing functional updates of a color vector. enum color { @@ -210,7 +210,7 @@ fn pbfs(graph: graph, key: node_id) -> bfs_result { black(node_id) }; - let mut colors = vec::from_fn(graph.len()) {|i| + let mut colors = vec::from_fn((*arc::get(&graph)).len()) {|i| if i as node_id == key { gray(key) } @@ -227,8 +227,6 @@ fn pbfs(graph: graph, key: node_id) -> bfs_result { } } - let graph = arc::arc(copy graph); - let mut i = 0u; while par::any(colors, is_gray) { // Do the BFS. @@ -386,7 +384,7 @@ fn main(args: [str]) { let scale = uint::from_str(args[1]).get(); let num_keys = uint::from_str(args[2]).get(); let do_validate = false; - let do_sequential = true; + let do_sequential = false; let start = time::precise_time_s(); let edges = make_edges(scale, 16u); @@ -409,6 +407,8 @@ fn main(args: [str]) { let mut total_seq = 0.0; let mut total_par = 0.0; + let graph_arc = arc::arc(copy graph); + gen_search_keys(graph, num_keys).map() {|root| io::stdout().write_line(""); io::stdout().write_line(#fmt("Search key: %?", root)); @@ -456,7 +456,7 @@ fn main(args: [str]) { } let start = time::precise_time_s(); - let bfs_tree = pbfs(graph, root); + let bfs_tree = pbfs(graph_arc, root); let stop = time::precise_time_s(); total_par += stop - start; |
