servo: Merge #17406 - use DisplayListBuilder::with_capacity (from Gankro:with_cap); r=jdm
authorAlexis Beingessner <a.beingessner@gmail.com>
Mon, 24 Jul 2017 09:02:50 -0700
changeset 421745 9dd60bf73988336871b087627eb849f043a43e5c
parent 421744 c6bbe349d654f15bf11baaa1f58638be640fa138
child 421746 b84484d5c6d57205e38121ddd5ffffbce25f09c7
push id1517
push userjlorenzo@mozilla.com
push dateThu, 14 Sep 2017 16:50:54 +0000
treeherdermozilla-release@3b41fd564418 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdm
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
servo: Merge #17406 - use DisplayListBuilder::with_capacity (from Gankro:with_cap); r=jdm DO NOT MERGE until https://github.com/servo/webrender/pull/1399 has landed in Servo. Previously webrender was reserving 1MB of space for each display list (empirically pages weighed between 100k and 10MB when I implemented this). This was problematic for gecko because they used webrender differently. This just brings Servo back to where it was. Source-Repo: https://github.com/servo/servo Source-Revision: 3629efba7508bf115ad0127d2567af7090a9f8ca
servo/components/layout/webrender_helpers.rs
--- a/servo/components/layout/webrender_helpers.rs
+++ b/servo/components/layout/webrender_helpers.rs
@@ -218,18 +218,19 @@ impl ToTransformStyle for transform_styl
         }
     }
 }
 
 impl WebRenderDisplayListConverter for DisplayList {
     fn convert_to_webrender(&self, pipeline_id: PipelineId) -> DisplayListBuilder {
         let traversal = DisplayListTraversal::new(self);
         let webrender_pipeline_id = pipeline_id.to_webrender();
-        let mut builder = DisplayListBuilder::new(webrender_pipeline_id,
-                                                  self.bounds().size.to_sizef());
+        let mut builder = DisplayListBuilder::with_capacity(webrender_pipeline_id,
+                                                            self.bounds().size.to_sizef(),
+                                                            1024 * 1024); // 1 MB of space
 
         let mut current_scroll_root_id = ClipId::root_scroll_node(webrender_pipeline_id);
         builder.push_clip_id(current_scroll_root_id);
 
         for item in traversal {
             item.convert_to_webrender(&mut builder, &mut current_scroll_root_id);
         }
         builder