-
Notifications
You must be signed in to change notification settings - Fork 155
Description
taffy version
Tested with latest main (e5b721cd225a306635ec3133ef154ea60ac37a39), but I believe this affects all versions of taffy.
Platform
Rust/macOS
What you did
I was interested to see how realistic the benchmarks were. In particular, the "big tree (100_000 nodes)/deep hierarchy" benchmark seemed unacceptably slow clocking in at around 2 seconds relatively fast M1 MacBook. However, 100,000 nodes seemed quite extreme I therefore decided to try a more realistic node count.
In order to determine what a realistic node count might be, I surveyed a few different web apps for both the total number of nodes and the maximum depth. The results were:
- Total number of nodes was generally between 3000 and 8000
- Max depth was generally between 14 and 34
I therefore updated the above benchmark to use a lower total node count of 10,000, but a branch factor (number of children per node) of 2 rather than 7. This leads to a depth of 14
What went wrong
In this configuration, taffy took 17.306s to run. Which is of course much slower than the shallower benchmark with 10x more nodes.
Additional information
I suspect this still isn't an entirely realistic benchmark, as it was not possible to set the branching factor low enough to match both the number of nodes and the depths I observed on websites (for example this github page I'm writing in now has a depth of 25 with only ~1300 total nodes), and it's possible that styles such as "width: 100%" are reducing the impact of depth in some cases. Nevertheless, I would expect most real-life layouts to have a depth of greater than 6.
Uses benchmarks from #165