<?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>123255</bug_id>
          
          <creation_ts>2013-10-24 01:03:55 -0700</creation_ts>
          <short_desc>Add result caching for Math.cos</short_desc>
          <delta_ts>2013-10-31 11:49:34 -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>JavaScriptCore</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</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="Iago Toral">itoral</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>commit-queue</cc>
    
    <cc>fpizlo</cc>
    
    <cc>ggaren</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>943018</commentid>
    <comment_count>0</comment_count>
    <who name="Iago Toral">itoral</who>
    <bug_when>2013-10-24 01:03:55 -0700</bug_when>
    <thetext>Currently JavaScriptCore caches results for Math.sin, as introduced by the patch for bug #38714. I think it makes sense to do the same for Math.cos, since the same rationale used for Math.sin applies to Math.cos and also because these two functions are typically used together, for example to compute rotation transformations.

I&apos;ll upload a patch shortly.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>943021</commentid>
    <comment_count>1</comment_count>
      <attachid>215035</attachid>
    <who name="Iago Toral">itoral</who>
    <bug_when>2013-10-24 01:13:52 -0700</bug_when>
    <thetext>Created attachment 215035
Adds result caching for Math.cos

A quick test consisting of averaging 5 consecutive runs of Sunspider shows a 1.9% benefit in my case.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>944956</commentid>
    <comment_count>2</comment_count>
      <attachid>215035</attachid>
    <who name="Brent Fulgham">bfulgham</who>
    <bug_when>2013-10-30 10:06:05 -0700</bug_when>
    <thetext>Comment on attachment 215035
Adds result caching for Math.cos

r=me</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>944998</commentid>
    <comment_count>3</comment_count>
      <attachid>215035</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2013-10-30 10:45:49 -0700</bug_when>
    <thetext>Comment on attachment 215035
Adds result caching for Math.cos

Clearing flags on attachment: 215035

Committed r158281: &lt;http://trac.webkit.org/changeset/158281&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>944999</commentid>
    <comment_count>4</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2013-10-30 10:45:51 -0700</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>945234</commentid>
    <comment_count>5</comment_count>
    <who name="Filip Pizlo">fpizlo</who>
    <bug_when>2013-10-30 16:44:44 -0700</bug_when>
    <thetext>Was this based on any benchmarking?  If so, why aren&apos;t the benchmarks part of the patch?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>945423</commentid>
    <comment_count>6</comment_count>
    <who name="Iago Toral">itoral</who>
    <bug_when>2013-10-31 00:04:59 -0700</bug_when>
    <thetext>(In reply to comment #5)
&gt; Was this based on any benchmarking?  If so, why aren&apos;t the benchmarks part of the patch?

I ran the sunspider benchmark to assess performance improvement, my tests showed a 1.9% performance improvement on this benchmark as I mention in comment #1.

I did not know there was a policy to include the benchmark results in the ChangeLog as part of the patch, so that was my bad :(</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>945539</commentid>
    <comment_count>7</comment_count>
    <who name="Filip Pizlo">fpizlo</who>
    <bug_when>2013-10-31 09:22:24 -0700</bug_when>
    <thetext>(In reply to comment #1)
&gt; Created an attachment (id=215035) [details]
&gt; Adds result caching for Math.cos
&gt; 
&gt; A quick test consisting of averaging 5 consecutive runs of Sunspider shows a 1.9% benefit in my case.

It&apos;s customary to post full performance results to bugzilla for optimizations like these.

It&apos;s customary to run more than just SunSpider.  It&apos;s unwise to rely on a single benchmark for optimizations.  For example, Octane, JSBench, and Kraken are also important benchmarks.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>945541</commentid>
    <comment_count>8</comment_count>
    <who name="Filip Pizlo">fpizlo</who>
    <bug_when>2013-10-31 09:23:40 -0700</bug_when>
    <thetext>Anyway, see: https://bugs.webkit.org/show_bug.cgi?id=123574</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>945618</commentid>
    <comment_count>9</comment_count>
    <who name="Filip Pizlo">fpizlo</who>
    <bug_when>2013-10-31 11:49:34 -0700</bug_when>
    <thetext>(In reply to comment #7)
&gt; (In reply to comment #1)
&gt; &gt; Created an attachment (id=215035) [details] [details]
&gt; &gt; Adds result caching for Math.cos
&gt; &gt; 
&gt; &gt; A quick test consisting of averaging 5 consecutive runs of Sunspider shows a 1.9% benefit in my case.
&gt; 
&gt; It&apos;s customary to post full performance results to bugzilla for optimizations like these.
&gt; 
&gt; It&apos;s customary to run more than just SunSpider.  It&apos;s unwise to rely on a single benchmark for optimizations.  For example, Octane, JSBench, and Kraken are also important benchmarks.

Also, I cannot reproduce the speed-up that you&apos;re reporting.  I&apos;m seeing a 0.35% difference before and after your patch and that difference is in the noise.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>215035</attachid>
            <date>2013-10-24 01:13:52 -0700</date>
            <delta_ts>2013-10-30 10:45:49 -0700</delta_ts>
            <desc>Adds result caching for Math.cos</desc>
            <filename>webkit.jsc.cachedcos.patch</filename>
            <type>text/plain</type>
            <size>1665</size>
            <attacher name="Iago Toral">itoral</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9KYXZhU2NyaXB0Q29yZS9DaGFuZ2VMb2cKPT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQotLS0gU291
cmNlL0phdmFTY3JpcHRDb3JlL0NoYW5nZUxvZwkocmV2aXNpb24gMTU3OTE3KQorKysgU291cmNl
L0phdmFTY3JpcHRDb3JlL0NoYW5nZUxvZwkod29ya2luZyBjb3B5KQpAQCAtMSwzICsxLDE0IEBA
CisyMDEzLTEwLTI0ICBJYWdvIFRvcmFsIFF1aXJvZ2EgIDxpdG9yYWxAaWdhbGlhLmNvbT4KKwor
ICAgICAgICBBZGQgcmVzdWx0IGNhY2hpbmcgZm9yIE1hdGguY29zCisgICAgICAgIGh0dHBzOi8v
YnVncy53ZWJraXQub3JnL3Nob3dfYnVnLmNnaT9pZD0xMjMyNTUKKworICAgICAgICBSZXZpZXdl
ZCBieSBOT0JPRFkgKE9PUFMhKS4KKworICAgICAgICAqIHJ1bnRpbWUvTWF0aE9iamVjdC5jcHA6
CisgICAgICAgIChKU0M6Om1hdGhQcm90b0Z1bmNDb3MpOgorICAgICAgICAqIHJ1bnRpbWUvVk0u
aDoKKwogMjAxMy0xMC0yMyAgRmlsaXAgUGl6bG8gIDxmcGl6bG9AYXBwbGUuY29tPgogCiAgICAg
ICAgIFB1dCBhbGwgdXNlcyBvZiBMTFZNIGludHJpbnNpY3MgYmVoaW5kIGEgc2luZ2xlIE9wdGlv
bgpJbmRleDogU291cmNlL0phdmFTY3JpcHRDb3JlL3J1bnRpbWUvTWF0aE9iamVjdC5jcHAKPT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PQotLS0gU291cmNlL0phdmFTY3JpcHRDb3JlL3J1bnRpbWUvTWF0aE9iamVjd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