aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout/layout_task.rs
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2015-03-18 21:06:02 -0700
committerPatrick Walton <pcwalton@mimiga.net>2015-04-01 08:58:16 -0700
commit750bbed2cbdd37677b9298c86e20fb6a2db33b23 (patch)
tree0ae3e3ac81eabd2a957a45293b8041ac5a470472 /components/layout/layout_task.rs
parent6824bc93241d8ad6eff30e5014d27b88ea8a65d7 (diff)
downloadservo-750bbed2cbdd37677b9298c86e20fb6a2db33b23.tar.gz
servo-750bbed2cbdd37677b9298c86e20fb6a2db33b23.zip
gfx: Perform more aggressive caching in
`FontContext::get_layout_font_group_for_style()`. There are several optimizations here: * We make font families atoms, to allow for quicker comparisons. * We precalculate an FNV hash of the relevant fields of the font style structure. * When obtaining a platform font group, we first check pointer equality for the font style. If there's no match, we go to the FNV hash. Only if both caches miss do we construct and cache a font group. Note that individual fonts are *also* cached; thus there are two layers of caching here. 15% improvement in total layout thread time for Facebook Timeline.
Diffstat (limited to 'components/layout/layout_task.rs')
-rw-r--r--components/layout/layout_task.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/components/layout/layout_task.rs b/components/layout/layout_task.rs
index c61f84cf066..33bf00e837f 100644
--- a/components/layout/layout_task.rs
+++ b/components/layout/layout_task.rs
@@ -597,7 +597,7 @@ impl LayoutTask {
if mq.evaluate(&rw_data.stylist.device) {
iter_font_face_rules(&sheet, &rw_data.stylist.device, &|family, src| {
- self.font_cache_task.add_web_font(family.to_owned(), (*src).clone());
+ self.font_cache_task.add_web_font((*family).clone(), (*src).clone());
});
rw_data.stylist.add_stylesheet(sheet);
}