Use a Vector instead of HashSet to computed the orderValues in RenderFlexibleBox
authorsvillar@igalia.com <svillar@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 Oct 2013 10:31:56 +0000 (10:31 +0000)
committersvillar@igalia.com <svillar@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 Oct 2013 10:31:56 +0000 (10:31 +0000)
commit45c0e311ccd45b96c51fc65395b55926c377c01b
treec97d4249bdb99e52eb3680bb78267941df0d9ce7
parent6a0bbc19ba454b4ceb35bd5761d6e15fec4037d2
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@157999 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