Bug 1647332 Comment 0 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

Currently, our column balancing algorithm can set a reasonable small range of infeasible bsize (lower bound) and feasible bsize (upper bound) in the second iteration [1] if it guesses a _feasible_ bsize in the first iteration. However, if the first guess is _infeasible_, the lower becomes the first guess bsize, but the upper bound remains the sum of all the content's bsize [2] because we measure the total content bsize via unconstrainted available bsize prior to balancing the columns). That leaves us a much broader range for the binary search to converge.

heycam noticed that the infeasible first guess can be easily observed by opening a wikipeda page that has a large "Reference" section such as [3]. On my screen resolution, the column container containing those references is about 1683px wide and is laid in into four columns. The balancing algorithm takes *21* iterations to find the optimal bsize.

heycam suggested we can use a better first guess than a fixed 600 app units [4] to reduce the rate of failed first guess.

[1] https://searchfox.org/mozilla-central/rev/1304678d837c17811617754fd446794b774afe94/layout/generic/nsColumnSetFrame.cpp#1005-1018
[2] https://searchfox.org/mozilla-central/rev/1304678d837c17811617754fd446794b774afe94/layout/generic/nsColumnSetFrame.cpp#1020-1038
[3] https://en.wikipedia.org/wiki/Coronavirus_disease_2019
[4] https://searchfox.org/mozilla-central/rev/1304678d837c17811617754fd446794b774afe94/layout/generic/nsColumnSetFrame.cpp#1074-1077
Currently, our column balancing algorithm can set a reasonable small range of infeasible bsize (lower bound) and feasible bsize (upper bound) in the second iteration [1] if it guesses a _feasible_ bsize in the first iteration. However, if the first guess is _infeasible_, the lower becomes the first guess bsize, but the upper bound remains the sum of all the content's bsize [2] because we measure the total content bsize via unconstrainted available bsize prior to balancing the columns). That leaves us a much broader range for the binary search to converge.

heycam noticed that the infeasible first guess can be easily observed by opening a wikipeda page that has a large "Reference" section such as [3]. On my screen resolution, the column container containing those references is about 1683px wide and is laid in into four columns. The balancing algorithm takes *15* iterations to find the optimal bsize.

heycam suggested we can use a better first guess than a fixed 600 app units [4] to reduce the rate of failed first guess.

[1] https://searchfox.org/mozilla-central/rev/1304678d837c17811617754fd446794b774afe94/layout/generic/nsColumnSetFrame.cpp#1005-1018
[2] https://searchfox.org/mozilla-central/rev/1304678d837c17811617754fd446794b774afe94/layout/generic/nsColumnSetFrame.cpp#1020-1038
[3] https://en.wikipedia.org/wiki/Coronavirus_disease_2019
[4] https://searchfox.org/mozilla-central/rev/1304678d837c17811617754fd446794b774afe94/layout/generic/nsColumnSetFrame.cpp#1074-1077

Back to Bug 1647332 Comment 0