DescriptionAvoid argument copying in WTF hash-based containers
The 'KeyPeekInType' used by WTF hash-based containers is declared as 'const T&' for most of the classes, the const reference however was lost in the previous implemntation of HashTable 'contains(KeyPeekInType)' and 'find(KeyPeekInType)' methods as it was deduced to 'T' in the further sub-calls (i.e. template<typename HashTranslator, typename T> ValueType* lookup(T)). This led to unneeded argument copying (2 times per each contains/find call!) and it significantly affected the performance for containers having String or AtomicString key types, such containers are widely used for example in Blink core/css code.
Below is the improvement of some randomly taken CSS performance tests results after the patch is applied (Linux desktop x64):
StyleSheetInsert.html - 3.4%
before:
avg 45.81039999999348 ms
median 45.569000000000415 ms
stdev 1.1590581657568524 ms
min 44.60299999993822 ms
max 48.70600000003833 ms
after:
avg 44.08615000000964 ms
median 44.036000000005515 ms
stdev 0.5594090185250097 ms
min 43.43600000004244 ms
max 45.64000000004853 ms
AttributeDescendantSelector.html - 7%
before:
avg 630.7230679370987 runs/s
median 631.5237186271941 runs/s
stdev 1.8378708385437512 runs/s
min 627.7266878002865 runs/s
max 632.970649942742 runs/s
after:
avg 676.0284840644981 runs/s
median 675.6238838914546 runs/s
stdev 2.1139085234317543 runs/s
min 673.3117355645138 runs/s
max 678.8715588063761 runs/s
CSSPropertyUpdateValue.html - 1.7%
before:
avg 16820.037469368264 runs/s
median 16812.805624173976 runs/s
stdev 70.629520115344 runs/s
min 16647.24488097132 runs/s
max 16989.1959332111 runs/s
after:
avg 17089.45990524665 runs/s
median 17093.550656512787 runs/s
stdev 54.79615592821426 runs/s
min 16962.157162336156 runs/s
max 17179.8873301988 runs/s
This patch also reduces content_shell binary size by 52KB.
Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=199826
Patch Set 1 #
Total comments: 2
Patch Set 2 : counter -> s_counter #Patch Set 3 : Fix unit test on Win #Patch Set 4 : Disabled test for Debug config. on Win. #Patch Set 5 : Disabled test on Win if assertions enabled #Patch Set 6 : Fix NRVO in test key traits on Win #
Total comments: 1
Patch Set 7 : Added explanation comment #Messages
Total messages: 25 (5 generated)
|