Speed up the prefix matching of cssPropertyName()
authorbenjamin@webkit.org <benjamin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 27 Jan 2012 22:47:39 +0000 (22:47 +0000)
committerbenjamin@webkit.org <benjamin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 27 Jan 2012 22:47:39 +0000 (22:47 +0000)
commita36470c68ccaef89cc4700283b8bdab485bb830e
tree902a42e10e06b50a81f55be6f99064a73d398b72
parent97bfc70ef76df2bcdd801bfa9000dfaf11ef254a
Speed up the prefix matching of cssPropertyName()
https://bugs.webkit.org/show_bug.cgi?id=77158

Patch by Benjamin Poulain <bpoulain@apple.com> on 2012-01-27
Reviewed by Geoffrey Garen.

This patch improves the performance by:
-not checking the PropertyName with all 7 prefix
 (now, in the worse case, 2 prefixes are checked)
-avoiding the conversion 8bits->16bits by using String::operator[]
 instead of ::characters()

To avoid checking every prefix, the code branch based on the first
characters of the propertyName.
The remaining of the prefix is checked character by characters like before.

When accessing CSS property, this gives a 13% improvement when there is no prefix.
There is no performance regression for the matching of prefix, including for the first one
of the previous matching code ("css").

* bindings/js/JSCSSStyleDeclarationCustom.cpp:
():
(WebCore::matchesCSSPropertyNamePrefix):
(WebCore):
(WebCore::getCSSPropertyNamePrefix):
(WebCore::cssPropertyName):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@106154 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp