From ff8598e6e4fb5db76b47c328c6615a0e55e8c29f Mon Sep 17 00:00:00 2001 From: VAN BOSSUYT Nicolas Date: Thu, 22 Aug 2024 14:00:00 +0200 Subject: [PATCH] vaev-driver: Added log output for rendering time. --- src/web/vaev-driver/render.cpp | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/web/vaev-driver/render.cpp b/src/web/vaev-driver/render.cpp index 8d34d7fac7..13f4686cf6 100644 --- a/src/web/vaev-driver/render.cpp +++ b/src/web/vaev-driver/render.cpp @@ -59,6 +59,8 @@ RenderResult render(Dom::Document const &dom, Style::Media const &media, Vec2Px auto elapsed = Sys::now() - start; logDebug("style collection time: {}", elapsed); + start = Sys::now(); + Style::Computer computer{media, stylebook}; Layout::Tree tree = { Layout::build(computer, dom), @@ -67,9 +69,15 @@ RenderResult render(Dom::Document const &dom, Style::Media const &media, Vec2Px } }; + elapsed = Sys::now() - start; + + logDebug("layout tree build time: {}", elapsed); + + start = Sys::now(); + Layout::Viewport vp{.small = viewport}; - auto height = Layout::computePreferredOuterSize( + auto height = Layout::computePreferredBorderSize( tree, tree.root, { @@ -79,6 +87,12 @@ RenderResult render(Dom::Document const &dom, Style::Media const &media, Vec2Px Axis::VERTICAL ); + elapsed = Sys::now() - start; + + logDebug("layout tree measure time: {}", elapsed); + + start = Sys::now(); + Layout::Box containingBox = { .borderBox = {vp.small.width, height}, }; @@ -95,9 +109,17 @@ RenderResult render(Dom::Document const &dom, Style::Media const &media, Vec2Px auto paintRoot = makeStrong(); + elapsed = Sys::now() - start; + logDebug("layout tree layout time: {}", elapsed); + + auto paintStart = Sys::now(); + Layout::paint(tree.root, *paintRoot); paintRoot->prepare(); + elapsed = Sys::now() - paintStart; + logDebug("layout tree paint time: {}", elapsed); + return { makeStrong(std::move(tree.root)), paintRoot, @@ -130,7 +152,7 @@ RenderResult render(Dom::Document &dom, Style::Media const &media, Print::PaperS vp, }; - auto height = Layout::computePreferredOuterSize( + auto height = Layout::computePreferredBorderSize( tree, tree.root, {