Use a Vector instead of HashSet to computed the orderValues in RenderFlexibleBox
authorsvillar@igalia.com <svillar@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 24 Oct 2013 06:53:10 +0000 (06:53 +0000)
committersvillar@igalia.com <svillar@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 24 Oct 2013 06:53:10 +0000 (06:53 +0000)
commit491ec0a6a88d9ee55267a612da78731ba29be61f
tree89849d03ea2868cea0463d0f7d7bd902521bde83
parent21803e09ea9b17d7c7b895f8a9c22990f30eeef3
Use a Vector instead of HashSet to computed the orderValues in RenderFlexibleBox
https://bugs.webkit.org/show_bug.cgi?id=118620

Reviewed by Antti Koivisto.

PerformanceTests:

From Blink r152960 by <ojan@chromium.org>

New performance test for layouts in flexboxes.

* Layout/flexbox-lots-of-data.html: Added.

Source/WebCore:

Turns out that order is extremelly uncommon so using a Vector is
much less expensive. This also special-cases the much common case
of only having order of value 0 by using Vectors with just one
preallocated member.

Also added the performance test that shows a ~1% win when using a
vector instead of the HashSet.

* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::OrderIterator::setOrderValues):
(WebCore::RenderFlexibleBox::layoutBlock):
(WebCore::RenderFlexibleBox::computeMainAxisPreferredSizes):
* rendering/RenderFlexibleBox.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@157916 268f45cc-cd09-0410-ab3c-d52691b4dbfc
PerformanceTests/ChangeLog
PerformanceTests/Layout/flexbox-lots-of-data.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderFlexibleBox.cpp
Source/WebCore/rendering/RenderFlexibleBox.h