Split text measurements cache from rendering cache

This speeds up layouting in the most common scenario considerably!
🎉
This commit is contained in:
Héctor Ramón Jiménez 2019-11-11 06:07:31 +01:00
parent d4d14b68f4
commit 860a6923bb
9 changed files with 53 additions and 24 deletions

View file

@ -97,7 +97,7 @@ where
pub fn build<E: Into<Element<'a, Message, Renderer>>>(
root: E,
cache: Cache,
renderer: &Renderer,
renderer: &mut Renderer,
) -> Self {
let root = root.into();
@ -110,7 +110,7 @@ where
cache.layout
} else {
let layout_start = std::time::Instant::now();
let layout = root.layout(renderer, &layout::Limits::NONE);
let layout = renderer.layout(&root);
dbg!(std::time::Instant::now() - layout_start);
layout