Mercurial > lbo > hg > localmr
changeset 102:937839e94473
Use contiguous arrays instead of vectors for caching input
author | Lewin Bormann <lbo@spheniscida.de> |
---|---|
date | Mon, 08 Feb 2016 19:48:56 +0000 |
parents | 97b70b7203a2 |
children | b39ff9b7d1c4 |
files | src/controller.rs |
diffstat | 1 files changed, 4 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/controller.rs Sun Feb 07 19:26:21 2016 +0000 +++ b/src/controller.rs Mon Feb 08 19:48:56 2016 +0000 @@ -63,7 +63,7 @@ controller.clean_up(); } - fn map_runner(mr: MR, params: MRParameters, inp: LinkedList<Record>) { + fn map_runner(mr: MR, params: MRParameters, inp: Vec<Record>) { if inp.len() == 0 { return; } @@ -74,13 +74,13 @@ fn read_map_input<In: Iterator<Item = Record>>(it: &mut In, approx_bytes: usize) - -> LinkedList<Record> { - let mut ll = LinkedList::new(); + -> Vec<Record> { + let mut ll = Vec::with_capacity(approx_bytes + 1024);; let mut bytes_read: usize = 0; for r in it { bytes_read += r.key.len() + r.value.len() + 4; // Heuristics :P - ll.push_back(r); + ll.push(r); if bytes_read > approx_bytes { break;