Skip to content

Commit

Permalink
Replacing uses of accumulating fold with sum
Browse files Browse the repository at this point in the history
  • Loading branch information
psdh committed Mar 2, 2015
1 parent fed8787 commit dbc654f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion components/util/memory.rs
Expand Up @@ -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;
Expand Down Expand Up @@ -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.
Expand Down

17 comments on commit dbc654f

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from jdm
at psdh@dbc654f

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging psdh/servo/foldsum = dbc654f into auto

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from jdm
at psdh@dbc654f

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging psdh/servo/foldsum = dbc654f into auto

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from jdm
at psdh@dbc654f

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging psdh/servo/foldsum = dbc654f into auto

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from jdm
at psdh@dbc654f

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging psdh/servo/foldsum = dbc654f into auto

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 290b025

Please sign in to comment.