Improved graph500 performance (Issue #2719)

This commit is contained in:
Eric Holk 2012-06-25 10:55:29 -07:00
parent e991855d66
commit 07e1d1c6b6
3 changed files with 6 additions and 5 deletions

View File

@ -179,7 +179,7 @@ fn reserve_at_least<T>(&v: [const T], n: uint) {
let mut v = [];
unchecked{reserve(v, n_elts);}
let mut i: uint = 0u;
while i < n_elts { v += [op(i)]; i += 1u; }
while i < n_elts unsafe { push(v, op(i)); i += 1u; }
ret v;
}
@ -564,7 +564,7 @@ fn grow_set<T: copy>(&v: [mut T], index: uint, initval: T, val: T) {
pure fn mapi<T, U>(v: [T]/&, f: fn(uint, T) -> U) -> [U] {
let mut result = [];
unchecked{reserve(result, len(v));}
for eachi(v) {|i, elem| result += [f(i, elem)]; }
for eachi(v) {|i, elem| unsafe { push(result, f(i, elem)); } }
ret result;
}

View File

@ -42,7 +42,7 @@ fn map_slices<A: copy send, B: copy send>(
// FIXME: why is the ::<A, ()> annotation required here? (#2617)
vec::unpack_slice::<A, ()>(xs) {|p, _len|
let f = f();
futures += [future::spawn() {|copy base|
let f = future::spawn() {|copy base|
unsafe {
let len = end - base;
let slice = (ptr::offset(p, base),
@ -55,7 +55,8 @@ fn map_slices<A: copy send, B: copy send>(
assert(vec::len(slice) == end - base);
f(base, slice)
}
}];
};
vec::push(futures, f);
};
base += items_per_task;
}

View File

@ -305,7 +305,7 @@ fn validate(edges: [(node_id, node_id)],
status = false;
}
path += [parent];
vec::push(path, parent);
parent = tree[parent];
}