<?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>38446</bug_id>
          
          <creation_ts>2010-05-02 20:55:35 -0700</creation_ts>
          <short_desc>SunSpider: all four bitops benchmarks can be replaced with NOP</short_desc>
          <delta_ts>2011-07-02 14:09:50 -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="Nicholas Nethercote">nnethercote</reporter>
          <assigned_to name="Maciej Stachowiak">mjs</assigned_to>
          <cc>ap</cc>
    
    <cc>brendan</cc>
    
    <cc>mjs</cc>
    
    <cc>oliver</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>220004</commentid>
    <comment_count>0</comment_count>
    <who name="Nicholas Nethercote">nnethercote</who>
    <bug_when>2010-05-02 20:55:35 -0700</bug_when>
    <thetext>There are four bitops benchmarks in SunSpider:  3bit-bits-in-byte, bits-in-byte, bitwise-and, nsieve-bits.  All of them compute things but never do anything with the computed values which means a sufficiently clever compiler can optimise them all down to a single NOP.

I noticed this because I&apos;m working on improving dead code elimination for Mozilla&apos;s TraceMonkey, which is now sufficiently clever to turn this (from 3bit-bits-in-byte):

  for(var y=0; y&lt;256; y++) func(y);

into an empty loop, because func() has no side effects and its result isn&apos;t used.  While this provides me personally with a certain level of satisfaction it doesn&apos;t seem a desirable property for a benchmark.

Note that some of these contain empty loops like this:

  for(var x=0; x&lt;500; x++)

which are presumably there to &quot;spin up&quot; the benchmark, but can also be eliminated entirely.

It&apos;s possible that some of the other SunSpider benchmarks have the same undesirable property, I haven&apos;t checked;  the bitops ones are certainly the smallest and so the most affected.  They should be changed to record a value and print it out at the end, something like that.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>226555</commentid>
    <comment_count>1</comment_count>
    <who name="Nicholas Nethercote">nnethercote</who>
    <bug_when>2010-05-16 15:32:02 -0700</bug_when>
    <thetext>I noticed recently that string-validate-input.js also has this property.  Because that benchmark is dominated by string concatenation, a JS engine can over-optimize this benchmark by applying a lazy concatenation approach -- ie. build a tree of to-be-concatenated strings and then concatenate them when needed.  Except in this string-validate-input.js the final string is never used so the actual final concatenation step is not needed.

The final string should be used.  Printing the whole thing out is a bad idea, it&apos;s 420,000 chars and so I/O costs would dominate.  Maybe printing out every 1000th char would be ok?  That provide a reasonable amount of &quot;use&quot; of the final string so that over-optimizing the benchmark would be difficult.  Or computing a really simple hash of the string would be a more thorough use.  bitops-bitwise-and.js provides an example of a really simple hash that could be used -- just &apos;&amp;&apos; together every char.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>431627</commentid>
    <comment_count>2</comment_count>
    <who name="Maciej Stachowiak">mjs</who>
    <bug_when>2011-07-02 13:06:21 -0700</bug_when>
    <thetext>(In reply to comment #1)
&gt; I noticed recently that string-validate-input.js also has this property.  Because that benchmark is dominated by string concatenation, a JS engine can over-optimize this benchmark by applying a lazy concatenation approach -- ie. build a tree of to-be-concatenated strings and then concatenate them when needed.  Except in this string-validate-input.js the final string is never used so the actual final concatenation step is not needed.
&gt; 
&gt; The final string should be used.  Printing the whole thing out is a bad idea, it&apos;s 420,000 chars and so I/O costs would dominate.  Maybe printing out every 1000th char would be ok?  That provide a reasonable amount of &quot;use&quot; of the final string so that over-optimizing the benchmark would be difficult.  Or computing a really simple hash of the string would be a more thorough use.  bitops-bitwise-and.js provides an example of a really simple hash that could be used -- just &apos;&amp;&apos; together every char.

I filed bug 63864 for this latter issue.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>431629</commentid>
    <comment_count>3</comment_count>
      <attachid>99558</attachid>
    <who name="Maciej Stachowiak">mjs</who>
    <bug_when>2011-07-02 13:34:41 -0700</bug_when>
    <thetext>Created attachment 99558
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>431636</commentid>
    <comment_count>4</comment_count>
    <who name="Maciej Stachowiak">mjs</who>
    <bug_when>2011-07-02 14:09:50 -0700</bug_when>
    <thetext>Committed r90319: &lt;http://trac.webkit.org/changeset/90319&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>99558</attachid>
            <date>2011-07-02 13:34:41 -0700</date>
            <delta_ts>2011-07-02 14:01:49 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-38446-20110702133439.patch</filename>
            <type>text/plain</type>
            <size>3556</size>
            <attacher name="Maciej Stachowiak">mjs</attacher>
            
              <data encoding="base64">SW5kZXg6IFBlcmZvcm1hbmNlVGVzdHMvU3VuU3BpZGVyL0NoYW5nZUxvZwo9PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0t
LSBQZXJmb3JtYW5jZVRlc3RzL1N1blNwaWRlci9DaGFuZ2VMb2cJKHJldmlzaW9uIDkwMzE2KQor
KysgUGVyZm9ybWFuY2VUZXN0cy9TdW5TcGlkZXIvQ2hhbmdlTG9nCSh3b3JraW5nIGNvcHkpCkBA
IC0xLDMgKzEsMTkgQEAKKzIwMTEtMDctMDIgIE1hY2llaiBTdGFjaG93aWFrICA8bWpzQGFwcGxl
LmNvbT4KKworICAgICAgICBSZXZpZXdlZCBieSBOT0JPRFk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sdCA9IHNpZXZlKCk7Cg==
</data>
<flag name="review"
          id="94074"
          type_id="1"
          status="+"
          setter="andersca"
    />
          </attachment>
      

    </bug>

</bugzilla>