Upgrade to Taffy main (Grid: min-contribution optimizations + floor AvailableSpace at 0) - #835
Conversation
…ce at 0 Pins taffy to DioxusLabs/taffy@9fa4b458 (PR #1177), which stops grid intrinsic track sizing from measuring items whose spanned tracks cannot receive the contribution. Also clamps the definite available size passed to inline layout so margin/inset subtraction from a zero-width container can no longer yield a negative available width.
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
main (Grid: skip min-contribution where possible + floor AvailableSpace at 0)
main (Grid: skip min-contribution where possible + floor AvailableSpace at 0)main (Grid: min-contribution optimizations + floor AvailableSpace at 0)
|
Just mirrored your new taffy pin in aginxbrowser (our taffy-based render stack — no stylo/parley, custom css+layout+paint on top of taffy leaves) and ran an A/B on the two revs. Your Wikipedia numbers reproduced in shape on a synthetic stand-in: en.wikipedia is unreachable from my network, so I built a 3000-paragraph page around the template from your PR description. Release binaries, loopback, median of 5, spread under 1%:
All three page shapes render pixel-identical across the upgrade (1,024,000 px compared, zero diffs), so for us it was pure wasted work being removed, no output change. Test suite count identical before/after. One attribution note for anyone else tracking the win: the rev jump 864b4fd → 1b918ba is 39 commits, and on our side #1119 (avoid unnecessary flex item min-content measurement) looks like it contributes at least as much as #1177 — our inline runs are flex rows, so every paragraph was eating a redundant min-content measure even on the definite-width variant. The grid fix is what makes the indefinite case collapse, though. Thanks for the detailed PR body — the "916 zero-width break_lines passes" line is what told me exactly which shape to build. |
|
Not sure what your setup is or what you were measuring, but 20s still seems very slow if it's a realistic page! |
|
Fair pushback — the framing was mine to fix, and I should have labeled what the seconds covered. Those numbers were our whole /screenshot pipeline end-to-end on loopback (HTML parse → style → taffy layout → paint → PNG encode), not layout-only, on a page built specifically to maximize the redundant-measurement path (I took the shape from your "916 zero-width break_lines passes" line). So the absolutes were a stress amplification, never "taffy time". I rebuilt the pages for a proper breakdown (so absolutes won't tie to my earlier 28.7→18.1 / 66→34 numbers — different generator, same stress idea), same harness for every row this time: release build, new rev, loopback, 1024x1000 viewport, median of 3:
So to your point directly: no, a realistic page is not 20s here — it's under a second through the whole pipeline. The seconds all live in the deliberate stress shape. And the breakdown says most of even that is ours, not yours: plain block-flow of 3000 paragraphs costs 6s (~2ms/paragraph, and a profiler pass points at our text shaping and glyph paint, not layout math). Grid on top adds ~2.7s at 3000 items with definite tracks and ~6.8s with intrinsic sizing engaged — so there's still measurable grid work left at that scale, worth a closer profile on our side before I claim where it sits between track math and our leaf measurement closures. Either way the upgrade was pure win for us: zero pixel diffs, and the intrinsic case roughly halved. |
上游 DioxusLabs#835 把 taffy 换成 DioxusLabs/taffy 的 git rev,git 依赖不带进 ReaderEngine, 故停在 DioxusLabs#835 的父 commit,跳过 DioxusLabs#835 与其后纯 CI 的 DioxusLabs#836。 三处冲突: - inline.rs:上游删掉 Node::style() 全迁 layout_style(),零尺寸定位容器补丁跟随; 遍历 children 时加 primary_styles() 守卫,layout_style() 对无样式节点会 panic。 - table.rs / border.rs:collapse 表格取本 fork 的 gutter 轨道实现,连带删掉上游 因此失效的 computed::BorderStyle 导入与 side_width。
Summary
taffy→ git9fa4b458f1a797b93cb2380f1e47c05d02a4fce3(Grid: skip contribution measurement when no spanned track can receive it taffy#1177). Taffy's grid intrinsic track sizing no longer measures an item's min-/max-content contribution when none of its spanned tracks can receive it (matches Blink). On Wikipedia's Vector skin (grid-template-columns: 12.25rem minmax(0, 1fr)) the old behaviour measured the whole article underMinContent, which line-broke ~880 inline layouts at width 0 and then threw the result away.compute_inline_layout_inner: the definite available size handed to Parley is clamped at 0 after subtracting margins / content-box insets, so a 0-width container with margined children no longer producesDefinite(-17.0)-style available widths (they only occurred inside the discarded pass above, but negative available width is never meaningful):Obama article, headless
resolve()at 1280px (examples/obama_benchfrom #832's branch, 3 runs each, medians):Zero-width
break_linespasses 916 → 3, root height unchanged. blitz-dom/blitz-html tests and workspace clippy pass.Link to Devin session: https://dioxus.staging.devinenterprise.com/sessions/3a0b8cc210c041d8955c841fb2a76a8e
Open in Devin Desktop: https://dioxus.staging.devinenterprise.com/desktop/session/3a0b8cc210c041d8955c841fb2a76a8e?variant=devin-insiders
Requested by: @nicoburns
WPT results
Subtests: 4 newly passing, 0 newly failing (net +4).
Full diff (4 changed tests)
Generated by the WPT workflow.