<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>73154</bug_id>
          
          <creation_ts>2011-11-25 21:16:03 -0800</creation_ts>
          <short_desc>String.prototype.toLower should be optimized for 8 bit strings</short_desc>
          <delta_ts>2011-11-26 09:40:21 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>JavaScriptCore</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Michael Saboff">msaboff</reporter>
          <assigned_to name="Michael Saboff">msaboff</assigned_to>
          <cc>darin</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>509318</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Saboff">msaboff</who>
    <bug_when>2011-11-25 21:16:03 -0800</bug_when>
    <thetext>String.protoype.toLower() uses UString.characters() and should be optimized for the underlying character size.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>509319</commentid>
    <comment_count>1</comment_count>
      <attachid>116647</attachid>
    <who name="Michael Saboff">msaboff</who>
    <bug_when>2011-11-25 21:23:46 -0800</bug_when>
    <thetext>Created attachment 116647
Patch

This speeds up sun spider string-tagcloud by 7%.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>509322</commentid>
    <comment_count>2</comment_count>
      <attachid>116647</attachid>
    <who name="Filip Pizlo">fpizlo</who>
    <bug_when>2011-11-25 21:36:05 -0800</bug_when>
    <thetext>Comment on attachment 116647
Patch

Can you put the perf effect in the ChangeLog?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>509327</commentid>
    <comment_count>3</comment_count>
    <who name="Michael Saboff">msaboff</who>
    <bug_when>2011-11-25 22:17:39 -0800</bug_when>
    <thetext>Committed r101187: &lt;http://trac.webkit.org/changeset/101187&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>509365</commentid>
    <comment_count>4</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2011-11-26 08:30:38 -0800</bug_when>
    <thetext>This removes the optimization for the case where the string was already all lowercase. It seems we could easily retain that by checking if the result of s.impl()-&gt;lower() is == s.impl() and if so, returning JSValue::encode(sVal).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>509369</commentid>
    <comment_count>5</comment_count>
    <who name="Michael Saboff">msaboff</who>
    <bug_when>2011-11-26 09:40:21 -0800</bug_when>
    <thetext>(In reply to comment #4)
&gt; This removes the optimization for the case where the string was already all lowercase. It seems we could easily retain that by checking if the result of s.impl()-&gt;lower() is == s.impl() and if so, returning JSValue::encode(sVal).

I had played with this a little and didn&apos;t get the return right so it failed some sputnik tests.  I just coded up a correct &quot;already lower case&quot; return and will be posting it in another bug.

It appears that the fast return is worth maybe a little in sun spider performance (.2ms overall).</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>116647</attachid>
            <date>2011-11-25 21:23:46 -0800</date>
            <delta_ts>2011-11-25 21:36:05 -0800</delta_ts>
            <desc>Patch</desc>
            <filename>73154.patch</filename>
            <type>text/plain</type>
            <size>2192</size>
            <attacher name="Michael Saboff">msaboff</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9KYXZhU2NyaXB0Q29yZS9DaGFuZ2VMb2cKPT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQotLS0gU291
cmNlL0phdmFTY3JpcHRDb3JlL0NoYW5nZUxvZwkocmV2aXNpb24gMTAxMTg1KQorKysgU291cmNl
L0phdmFTY3JpcHRDb3JlL0NoYW5nZUxvZwkod29ya2luZyBjb3B5KQpAQCAtMSwzICsxLDE2IEBA
CisyMDExLTExLTI1ICBNaWNoYWVsIFNhYm9mZiAgPG1zYWJvZmZAYXBwbGUuY29tPgorCisgICAg
ICAgIFN0cmluZy5wcm90b3R5cGUudG9Mb3dlciBzaG91bGQgYmUgb3B0aW1pemVkIGZvciA4IGJp
dCBzdHJpbmdzCisgICAgICAgIGh0dHBzOi8vYnVncy53ZWJraXQub3JnL3Nob3dfYnVnLmNnaT9p
ZD03MzE1NAorCisgICAgICAgIENoYW5nZWQgc3RyaW5nUHJvdG9GdW5jVG9Mb3dlckNhc2UgdG8g
dXNlIFN0cmluZ0ltcGw6Omxvd2VyKCkgd2hpY2ggaGFzCisgICAgICAgIGJlZW4gb3B0aW1pemVk
IGZvciA4IGJpdCBzdHJpbmdzLgorCisgICAgICAgIFJldmlld2VkIGJ5IE5PQk9EWSAoT09QUyEp
LgorCisgICAgICAgICogcnVudGltZS9TdHJpbmdQcm90b3R5cGUuY3BwOgorICAgICAgICAoSlND
OjpzdHJpbmdQcm90b0Z1bmNUb0xvd2VyQ2FzZSk6CisKIDIwMTEtMTEtMjQgIE1pY2hhZWwgU2Fi
b2ZmICA8bXNhYm9mZkBhcHBsZS5jb20+CiAKICAgICAgICAgVVN0cmluZyBtZXRob2RzIGFyZSBu
b3QgY2hhcmFjdGVyIHNpemUgYXdhcmUKSW5kZXg6IFNvdXJjZS9KYXZhU2NyaXB0Q29yZS9ydW50
aW1lL1N0cmluZ1Byb3RvdHlwZS5jcHAKPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQotLS0gU291cmNlL0phd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ICZlcnJv
cik7Ci0gICAgICAgIGlmIChlcnJvcikKLSAgICAgICAgICAgIHJldHVybiBKU1ZhbHVlOjplbmNv
ZGUoc1ZhbCk7Ci0gICAgfQotICAgIGlmIChsZW5ndGggPT0gc1NpemUpIHsKLSAgICAgICAgaWYg
KG1lbWNtcChidWZmZXIuZGF0YSgpLCBzRGF0YSwgbGVuZ3RoICogc2l6ZW9mKFVDaGFyKSkgPT0g
MCkKLSAgICAgICAgICAgIHJldHVybiBKU1ZhbHVlOjplbmNvZGUoc1ZhbCk7Ci0gICAgfSBlbHNl
Ci0gICAgICAgIGJ1ZmZlci5yZXNpemUobGVuZ3RoKTsKLSAgICByZXR1cm4gSlNWYWx1ZTo6ZW5j
b2RlKGpzU3RyaW5nKGV4ZWMsIFVTdHJpbmc6OmFkb3B0KGJ1ZmZlcikpKTsKKyAgICByZXR1cm4g
SlNWYWx1ZTo6ZW5jb2RlKGpzU3RyaW5nKGV4ZWMsIFVTdHJpbmcocy5pbXBsKCktPmxvd2VyKCkp
KSk7CiB9CiAKIEVuY29kZWRKU1ZhbHVlIEpTQ19IT1NUX0NBTEwgc3RyaW5nUHJvdG9GdW5jVG9V
cHBlckNhc2UoRXhlY1N0YXRlKiBleGVjKQo=
</data>
<flag name="review"
          id="115865"
          type_id="1"
          status="+"
          setter="fpizlo"
    />
          </attachment>
      

    </bug>

</bugzilla>