<?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>30436</bug_id>
          
          <creation_ts>2009-10-16 02:33:32 -0700</creation_ts>
          <short_desc>fast/css/large-list-of-rules-crash.html concatenates strings in an inefficient way</short_desc>
          <delta_ts>2009-10-18 00:26:05 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Tools / Tests</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>PC</rep_platform>
          <op_sys>OS X 10.5</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>0</everconfirmed>
          <reporter name="Yuta Kitamura">yutak</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>commit-queue</cc>
    
    <cc>mrowe</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>155051</commentid>
    <comment_count>0</comment_count>
    <who name="Yuta Kitamura">yutak</who>
    <bug_when>2009-10-16 02:33:32 -0700</bug_when>
    <thetext>LayoutTest/fast/css/large-list-of-rules-crash.html contains JavaScript code that repeatedly concatenates strings in an inefficient way. Concatenation of strings should be done using Array.join method.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>155052</commentid>
    <comment_count>1</comment_count>
      <attachid>41279</attachid>
    <who name="Yuta Kitamura">yutak</who>
    <bug_when>2009-10-16 02:38:49 -0700</bug_when>
    <thetext>Created attachment 41279
Fix inefficient string concatenation.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>155056</commentid>
    <comment_count>2</comment_count>
    <who name="Mark Rowe (bdash)">mrowe</who>
    <bug_when>2009-10-16 03:11:30 -0700</bug_when>
    <thetext>Can you please explain why this change is necessary?  In my measurements with TOT WebKit there’s approximately 10ms of difference between the two approaches, accounting for less than 2% of the execution time of this test.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>155447</commentid>
    <comment_count>3</comment_count>
    <who name="Yuta Kitamura">yutak</who>
    <bug_when>2009-10-17 22:45:11 -0700</bug_when>
    <thetext>(In reply to comment #2)
&gt; Can you please explain why this change is necessary?  In my measurements with
&gt; TOT WebKit there’s approximately 10ms of difference between the two approaches,
&gt; accounting for less than 2% of the execution time of this test.

Yes, as for JavaScriptCore, only small improvement can be observed. However, currently debug version of V8 is hitting this problem and consuming test cycles.

I admit the argument above is weak..., but I believe there is no need to leave an inefficient test as is.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>155448</commentid>
    <comment_count>4</comment_count>
    <who name="Mark Rowe (bdash)">mrowe</who>
    <bug_when>2009-10-17 22:46:34 -0700</bug_when>
    <thetext>It’d be stronger if you took a few seconds to provide data to support your claim that it is inefficient.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>155451</commentid>
    <comment_count>5</comment_count>
    <who name="Yuta Kitamura">yutak</who>
    <bug_when>2009-10-17 22:57:45 -0700</bug_when>
    <thetext>(In reply to comment #4)
&gt; It’d be stronger if you took a few seconds to provide data to support your
&gt; claim that it is inefficient.

Original code look like this:
    var s = &quot;&quot;;
    for (i = 0 ; i &lt; 200000 ; i++) {
        s += &quot;a {}\n&quot;;
    }

This code produces potentially (especially for debug binary) allocation of 200000 string objects with length of 5, 10, 15, ..., 5*200000. The fixed version does not require the intermediate string objects.

I believe using Array.join is the common pattern to avoid unneeded allocation.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>155452</commentid>
    <comment_count>6</comment_count>
    <who name="Mark Rowe (bdash)">mrowe</who>
    <bug_when>2009-10-17 23:02:46 -0700</bug_when>
    <thetext>You’ve just restated what the patch does.  I’m interested in specifics about how much of an improvement this change is.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>155453</commentid>
    <comment_count>7</comment_count>
    <who name="Yuta Kitamura">yutak</who>
    <bug_when>2009-10-17 23:13:29 -0700</bug_when>
    <thetext>(In reply to comment #6)
&gt; You’ve just restated what the patch does.  I’m interested in specifics about
&gt; how much of an improvement this change is.

From 30sec to 3sec, as for V8 debug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>155455</commentid>
    <comment_count>8</comment_count>
    <who name="Mark Rowe (bdash)">mrowe</who>
    <bug_when>2009-10-17 23:15:14 -0700</bug_when>
    <thetext>Thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>155457</commentid>
    <comment_count>9</comment_count>
      <attachid>41279</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2009-10-17 23:27:24 -0700</bug_when>
    <thetext>Comment on attachment 41279
Fix inefficient string concatenation.

Clearing flags on attachment: 41279

Committed r49748: &lt;http://trac.webkit.org/changeset/49748&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>155458</commentid>
    <comment_count>10</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2009-10-17 23:27:27 -0700</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>155460</commentid>
    <comment_count>11</comment_count>
    <who name="Yuta Kitamura">yutak</who>
    <bug_when>2009-10-18 00:26:05 -0700</bug_when>
    <thetext>Thanks!</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>41279</attachid>
            <date>2009-10-16 02:38:49 -0700</date>
            <delta_ts>2009-10-17 23:27:24 -0700</delta_ts>
            <desc>Fix inefficient string concatenation.</desc>
            <filename>bug-30436-20091016183848.patch</filename>
            <type>text/plain</type>
            <size>2123</size>
            <attacher name="Yuta Kitamura">yutak</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL0xheW91dFRlc3RzL0NoYW5nZUxvZyBiL0xheW91dFRlc3RzL0NoYW5nZUxv
ZwppbmRleCBiMmJhNTY2Li5iYTNmZTc1IDEwMDY0NAotLS0gYS9MYXlvdXRUZXN0cy9DaGFuZ2VM
b2cKKysrIGIvTGF5b3V0VGVzdHMvQ2hhbmdlTG9nCkBAIC0xLDMgKzEsMTkgQEAKKzIwMDktMTAt
MTYgIFl1dGEgS2l0YW11cmEgIDx5dXRha0BjaHJvbWl1bS5vcmc+CisKKyAgICAgICAgUmV2aWV3
ZWQgYnkgTk9CT0RZIChPT1BTISkuCisKKyAgICAgICAgRml4IGluZWZmaWNpZW50IHN0cmluZyBj
b25jYXRlbmF0aW9uLgorICAgICAgICAKKyAgICAgICAgTGF5b3V0VGVzdHMvZmFzdC9jc3MvbGFy
Z2UtbGlzdC1vZi1ydWxlcy1jcmFzaC5odG1sIGNvbnRhaW5zIGNvZGUgdGhhdAorICAgICAgICBj
b25jYXRlbmF0ZSBzdHJpbmdzIGluIGFuIGluZWZmaWNpZW50IHdheS4gQ29uY2F0ZW5hdGlvbiBv
ZiBzdHJpbmdzIHNob3VsZCBiZQorICAgICAgICBkb25lIHdpdGggQXJyYXkuam9pbiBtZXRob2Qu
IFRoaXMgcGF0Y2ggZml4ZXMgdGhpcyBpc3N1ZSwgYW5kIGFsc28gZml4ZXMgdHlwb3MKKyAgICAg
ICAgaW4gdGhlIHRlc3QuCisKKyAgICAgICAgZmFzdC9jc3MvbGFyZ2UtbGlzdC1vZi1ydWxlcy1j
cmFzaC5odG1sIGNvbmNhdGVuYXRlcyBzdHJpbmdzIGluIGFuIGluZWZmaWNpZW50IHdheQorICAg
ICAgICBodHRwczovL2J1Z3Mud2Via2l0Lm9yZy9zaG93X2J1Zy5jZ2k/aWQ9MzA0MzYKKworICAg
ICAgICAqIGZhc3QvY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