diff options
author | Nicholas Nethercote <nnethercote@mozilla.com> | 2015-03-10 21:01:05 -0700 |
---|---|---|
committer | Nicholas Nethercote <nnethercote@mozilla.com> | 2015-03-16 18:12:26 -0700 |
commit | ece2711185cffa8ade21b0ab9538bc1be79cadb9 (patch) | |
tree | 5870d8186ce791809ad1afcf65886767ea871a6b /components/servo | |
parent | 5865d5f71776336d8f55dcb326d1fb24279bbf63 (diff) | |
download | servo-ece2711185cffa8ade21b0ab9538bc1be79cadb9.tar.gz servo-ece2711185cffa8ade21b0ab9538bc1be79cadb9.zip |
Add memory reporting infrastructure and use it to measure the display list.
This changeset implements the beginnings of fine-grained measurement of
Servo's data structures.
- It adds a new `SizeOf` trait, which is used to measure the memory used
by heap data structures, and implements it for some std types: Box,
String, Option, Arc, Vec, and DList.
- It adds a new `MemoryReporter` trait which is used to report memory
measurements from other threads to the memory profiler. Reporters are
registered and unregistered with the memory profiler, and the memory
profiler makes measurement requests of reporters when necessary.
- It plumbs a MemoryProfilerChan through to the layout task so it can
register a memory reporter.
- It implements the `SizeOf` trait for `DisplayList` and associated
types, and adds a memory reporter that uses it.
The display list hits 14.77 MiB when viewing
tests/html/perf-rainbow.html, and 2.51 MiB when viewing the Guardians of
the Galaxy Wikipedia page from servo-static-suite. Example output:
0.29: display-list::http://www.reddit.com/
0.00: display-list::http://static.adzerk.net/reddit/ads.html?sr=-reddit.com,loggedout&bust2#http://www.reddit.com
0.00: display-list::http://www.reddit.com/static/createadframe.html
There are a number of FIXME comments indicating sub-optimal things. This
is a big enough change for now that doing them as follow-ups seems best.
Diffstat (limited to 'components/servo')
-rw-r--r-- | components/servo/Cargo.lock | 1 | ||||
-rw-r--r-- | components/servo/lib.rs | 2 |
2 files changed, 3 insertions, 0 deletions
diff --git a/components/servo/Cargo.lock b/components/servo/Cargo.lock index 41ab61464dc..f58178f144d 100644 --- a/components/servo/Cargo.lock +++ b/components/servo/Cargo.lock @@ -534,6 +534,7 @@ dependencies = [ "msg 0.0.1", "net 0.0.1", "script_traits 0.0.1", + "url 0.2.19 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", ] diff --git a/components/servo/lib.rs b/components/servo/lib.rs index ef2b1b320c5..c41b5df01af 100644 --- a/components/servo/lib.rs +++ b/components/servo/lib.rs @@ -82,6 +82,7 @@ impl<Window> Browser<Window> where Window: WindowMethods + 'static { let opts_clone = opts.clone(); let time_profiler_chan_clone = time_profiler_chan.clone(); + let memory_profiler_chan_clone = memory_profiler_chan.clone(); let (result_chan, result_port) = channel(); let compositor_proxy_for_constellation = compositor_proxy.clone_compositor_proxy(); @@ -109,6 +110,7 @@ impl<Window> Browser<Window> where Window: WindowMethods + 'static { image_cache_task, font_cache_task, time_profiler_chan_clone, + memory_profiler_chan_clone, devtools_chan, storage_task); |