Optimize StringImpl::lower() for 8-bit strings

The StringImpl::lower() method is used very intensively in blink, for example Intel Vtunes Amplifier profiler shows this method as a biggest hotspot by CPU usage viewpont when the 'AttributeDescendantSelector.html' CSS performance test is running.

This path optimizes cycles in StringImpl::lower() for 8-bit strings in order to avoid unneeded iterations and to re-use the already calculated data as much as possible.

After this patch is applied the 'AttributeDescendantSelector.html' performance test shows approx. 13% results improvement (linux desktop x64):

before
avg 561.7456430409343 runs/s
median 562.560813181673 runs/s
stdev 11.976426704572622 runs/s
min 529.8020262095021 runs/s
max 577.3626598774758 runs/s

after
avg 631.9779597646024 runs/s
median 636.3358333128829 runs/s
stdev 12.060471875689105 runs/s
min 602.4807143680587 runs/s
max 642.217924282401 runs/s

A unit test has been added to verify the method's behavior.

Review URL: https://codereview.chromium.org/1181013008

git-svn-id: svn://svn.chromium.org/blink/trunk@197102 bbb929c8-8fbe-4397-9dbb-9b2b20218538
2 files changed
tree: 174b7aaa2c0c37c2a800f0b84439d6f24f5e0737
  1. third_party/