8000 [css-grid-3] intrinsic track sizing algorithm for masonry can go exponential in complexity. · Issue #10053 · w3c/csswg-drafts · GitHub
[go: up one dir, main page]

Skip to content

[css-grid-3] intrinsic track sizing algorithm for masonry can go exponential in complexity. #10053

@bfgeek

Description

@bfgeek

https://drafts.csswg.org/css-grid-3/#track-sizing

Currently you need to place everything in every possible position. With subgrid this means that the complexity can go ~exponential (or sub-exponential).

<div style="grid-template: masonry / repeat(10, auto);">
  <div style="grid-template: subgrid / subgrid; grid-column: auto / span 6;"> <!-- 5 positions -->
    <div style="grid-template: subgrid / subgrid; grid-column: auto / span 3;"> <!-- 4 positions -->
      <div></div> <!-- 3 positions -->
    </div>
  </div>
</div>

In the above example there are 60 positions you need to test (each subgrid level might have different margin/border/padding which needs to be taken into account for the items contribution in a particular position along with many other factors).

In Blink we've spent most of our performance work in layout fixing exponential time bugs - developers really care about layout time performance. While these issues were quality of implementation bugs (and not a core problem with a particular spec), having exponential time complexity in a spec seems bad[1].

[1] - Exponential time complexity doesn't care how powerful your CPU is - it'll always win.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0