Skip to content
Permalink
Browse files

Replacing uses of accumulating fold with sum

  • Loading branch information...
psdh committed Mar 2, 2015
1 parent fed8787 commit dbc654ffa8960649ad9a74f964e8e44192717306
Showing with 2 additions and 1 deletion.
  1. +2 −1 components/util/memory.rs
@@ -7,6 +7,7 @@
use libc::{c_char,c_int,c_void,size_t};
use std::borrow::ToOwned;
use std::ffi::CString;
use std::iter::AdditiveIterator;
use std::old_io::timer::sleep;
#[cfg(target_os="linux")]
use std::old_io::File;
@@ -380,7 +381,7 @@ fn get_resident_segments() -> Vec<(String, u64)> {
// from the "resident" measurement obtained via /proc/<pid>/statm in
// get_resident(). It's unclear why this difference occurs; for some
// processes the measurements match, but for Servo they do not.
let total = segs.iter().fold(0u64, |total, &(_, size)| total + size);
let total = segs.iter().map(|&(_, size)| size).sum();
segs.push(("resident-according-to-smaps".to_owned(), total));

// Sort by size; the total will be first.

17 comments on commit dbc654f

@bors-servo

This comment has been minimized.

Copy link
Contributor

bors-servo replied Mar 2, 2015

saw approval from jdm
at psdh@dbc654f

@bors-servo

This comment has been minimized.

Copy link
Contributor

bors-servo replied Mar 2, 2015

merging psdh/servo/foldsum = dbc654f into auto

@bors-servo

This comment has been minimized.

Copy link
Contributor

bors-servo replied Mar 2, 2015

psdh/servo/foldsum = dbc654f merged ok, testing candidate = ec1fc1d

@bors-servo

This comment has been minimized.

Copy link
Contributor

bors-servo replied Mar 2, 2015

@bors-servo

This comment has been minimized.

Copy link
Contributor

bors-servo replied Mar 2, 2015

saw approval from jdm
at psdh@dbc654f

@bors-servo

This comment has been minimized.

Copy link
Contributor

bors-servo replied Mar 2, 2015

merging psdh/servo/foldsum = dbc654f into auto

@bors-servo

This comment has been minimized.

Copy link
Contributor

bors-servo replied Mar 2, 2015

psdh/servo/foldsum = dbc654f merged ok, testing candidate = 81f7d62

@bors-servo

This comment has been minimized.

Copy link
Contributor

bors-servo replied Mar 2, 2015

@bors-servo

This comment has been minimized.

Copy link
Contributor

bors-servo replied Mar 2, 2015

saw approval from jdm
at psdh@dbc654f

@bors-servo

This comment has been minimized.

Copy link
Contributor

bors-servo replied Mar 2, 2015

merging psdh/servo/foldsum = dbc654f into auto

@bors-servo

This comment has been minimized.

Copy link
Contributor

bors-servo replied Mar 2, 2015

psdh/servo/foldsum = dbc654f merged ok, testing candidate = 18316d19

@bors-servo

This comment has been minimized.

Copy link
Contributor

bors-servo replied Mar 2, 2015

@bors-servo

This comment has been minimized.

Copy link
Contributor

bors-servo replied Mar 3, 2015

saw approval from jdm
at psdh@dbc654f

@bors-servo

This comment has been minimized.

Copy link
Contributor

bors-servo replied Mar 3, 2015

merging psdh/servo/foldsum = dbc654f into auto

@bors-servo

This comment has been minimized.

Copy link
Contributor

bors-servo replied Mar 3, 2015

psdh/servo/foldsum = dbc654f merged ok, testing candidate = 290b025

@bors-servo

This comment has been minimized.

Copy link
Contributor

bors-servo replied Mar 3, 2015

fast-forwarding master to auto = 290b025

Please sign in to comment.
You can’t perform that action at this time.