<?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>3906</bug_id>
          
          <creation_ts>2005-07-08 09:42:07 -0700</creation_ts>
          <short_desc>some date operations are slow, too slow to enable the Mozilla date test suite</short_desc>
          <delta_ts>2008-09-03 02:45:03 -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>412</version>
          <rep_platform>Mac</rep_platform>
          <op_sys>OS X 10.4</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>
          <dependson>3759</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Geoffrey Garen">ggaren</reporter>
          <assigned_to name="Geoffrey Garen">ggaren</assigned_to>
          <cc>ian</cc>
    
    <cc>zwarich</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>14207</commentid>
    <comment_count>0</comment_count>
    <who name="Geoffrey Garen">ggaren</who>
    <bug_when>2005-07-08 09:42:07 -0700</bug_when>
    <thetext>&lt;a href http://bugzilla.opendarwin.org/show_bug.cgi?id=3864&gt;Bug 3864&lt;/a&gt; has a patch to enable the 
date tests in the mozilla test suite. Apply it, run the tests, and watch your dual g5 machine magically 
transform into a commodore.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>14234</commentid>
    <comment_count>1</comment_count>
    <who name="Carsten Guenther">carsten</who>
    <bug_when>2005-07-08 13:46:36 -0700</bug_when>
    <thetext>I noticed that as well. Date performance is next on my list after Bug 3759 is
fixed. One problem with our date implementation is that a date object only
stores the time (number of milliseconds since 1/1/70 UTC) and calling a getter
or setter for some date component results in a calculation. Mozilla has the same
problem afaik. IE is much faster, I assume they store those components in the
object and only do the calculations when necessary.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>14425</commentid>
    <comment_count>2</comment_count>
    <who name="Carsten Guenther">carsten</who>
    <bug_when>2005-07-11 21:55:33 -0700</bug_when>
    <thetext>I will look into that.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>15102</commentid>
    <comment_count>3</comment_count>
    <who name="Geoffrey Garen">ggaren</who>
    <bug_when>2005-07-23 10:52:00 -0700</bug_when>
    <thetext>The Shark profiler doesn&apos;t indicate any particular bottleneck. 

It looks like one major cause of this problem is that the date tests include huge loops - on the order of 
billions of iterations. Consider ecma/Date/15.9.5.10-2.js. The first call to addTestCase causes a loop of 
2,678,400,000 iterations, with a call to TimeInMonth, MonthFromTime, and DateFromTime in each 
loop. These functions are defined in ecma/shell.js, and they don&apos;t even use JavaScriptCore&apos;s date 
machinery. (They&apos;re independent date calculators written totally in JS, used to determine if the result 
returned by JSC is correct.) The only call to JSC&apos;s date code is &quot;(new Date(t)).getDate()&quot;.

On my machine, the running time of the loop is 39.4 seconds. Still, each function call only takes 39.4s / 
2678400000 iterations / 3 calls per iteration == 0.0000000049s, which is not bad.

On my machine, creating 100,000 Date objects in a loop takes 5.95 seconds. Calling setMinutes
(123456) on each object takes an additional 4.46 seconds.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>15182</commentid>
    <comment_count>4</comment_count>
    <who name="Geoffrey Garen">ggaren</who>
    <bug_when>2005-07-25 16:37:48 -0700</bug_when>
    <thetext>(In reply to comment #3)

It&apos;s not actually 2,678,400,000 iterations; I wasn&apos;t considering the stepping size of the loop. The main 
thing that makes the tests too slow to run is that the development build isn&apos;t optimized for these loops 
(which, though not in the billions, are still significant).

Our deployment build runs 15.9.5.10-2.js faster than ff, but slower (2x) than ie and opera. </thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>15183</commentid>
    <comment_count>5</comment_count>
    <who name="Carsten Guenther">carsten</who>
    <bug_when>2005-07-25 19:29:52 -0700</bug_when>
    <thetext>I believe the remaining difference between Safari and IE is due to what I described in comment #1. Once 
bug 3759 is fixed I want to make some changes that should improve performance, basically by keeping 
the tm structure and a field for the milliseconds around instead of recalculating everything from the 
internal value all the time.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>71525</commentid>
    <comment_count>6</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2008-02-22 16:03:35 -0800</bug_when>
    <thetext>I think this may be closed now.  Geoff?

</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89995</commentid>
    <comment_count>7</comment_count>
    <who name="Cameron Zwarich (cpst)">zwarich</who>
    <bug_when>2008-09-03 02:45:03 -0700</bug_when>
    <thetext>We enabled the date test suite long ago, so this bug can be closed.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>