Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: stata 10 mp2 vs stata9


From   wgould@stata.com (William Gould, StataCorp LP)
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: stata 10 mp2 vs stata9
Date   Fri, 24 Aug 2007 15:22:57 -0500

Al Feiveson <alan.h.feiveson@nasa.gov> reports, 

        > Stata 9 (IC)

        > . forvalues i=1/100000 {
        > 2.   timer on 1
        > 3.   quietly regress price weight
        > 4.   timer off 1
        > 5. }

        > . 
        > . timer list 1
        >     1:    21.64 /   100000 =       0.0002 

        > Stata 10 (IC)
        > . forvalues i=1/100000 {
        >   2.   timer on 1
        >   3.   quietly regress price weight
        >   4.   timer off 1
        >   5. }
        > 
        > . 
        > . timer list 1
        >    1:     27.53 /   100000 =       0.0003

and Thomas Steichen <steicht@rjrt.com> reports similar results, 
   
        > Stata 9 (SE):    1:     21.77 /   100000 =       0.0002
        > Stata 10 (SE):   1:     27.70 /   100000 =       0.0003

and, before others do the same timing, let me say that we at StataCorp obtain
similar results.

On the face of it, the above timings suggest Stata 10 is 27% slower than Stata
9.  These timing are, however, misleading as they are dominated by a minor
change that was made to regress.ado between Stata 9 and Stata 10 and what was
discovered is that this minor change adds about .000059 seconds to the
execution of regress.ado.  Most importantly, this addition is independent of
problem size.  In 100,000 replications done above, the additional execution
time was a fixed 5.9 seconds.  If we used larger and larger regession
problems, even one that took 10,000.00 seconds to estimate 100,000 times, the
difference would still be 5.9 seconds; 10,005.90 seconds for Stata 10 and
10,000.00 for Stata 9.

Actually, in this case we can skip the ado-file altogether.  Run the
following:

          . forvalues i=1/100000 {
          2.   timer on 1
          3.   quietly _regress price weight
          4.   timer off 1
          5. }

Note the underscore as the first character of _regress.  _regress runs the
internal regression command, skipping the ado-file (which calls _regress).

We ran the above on three different Windows computers here, and got the same
timings for Stata 9 and Stata 10.

We have no doubts that you can find problems where Stata 10 is significantly,
even 27% slower than than Stata 9.  You can similarly find problems where
Stata 10 is 27% faster.  Our timings on a much broader suite of problems
suggests to us that most users will find that Stata 10 is faster than Stata 9
on average.

-regress- is an unusual case because of the additional fixed cost of running
regress.ado.  At StataCorp, we worry about fixed costs -- the portion of time
that is independent of problem size -- but we worry more about about the
portion of time that is dependent on problem size because, in the real world,
that is where most of the time goes.  Thus, when we test, we do not test on 72
observations with two variables; we prefer thousands of observations and
hundreds of variables.

This thread started when Jetian Sheu <jtsheu@mail.cgu.edu.tw> reported 
that Stata 10 ran slower than Stata 9 on his computer, but provided no 
details.  When Jetian Sheu made that post, we contacted him privately so that
we could duplicate his results.  He has yet to respond to us.  Right now, we
do not know what the cause of Jetian's finding might be or even if it is
indicative of a problem.

-- Bill                  -- Vince
   wgould@stata.com         vwiggins@stata.com


P.S.  -regress- is an even odder problem than we suspected.  We noted 
      in the above post that we got the same timings in Stata 9 and 
      Stata 10 under Windows.  When we ran under Linux, however, 
      on two different we got Stata 9 being a little (3, maybe 5%) 
      faster than Stata 10, and that surprised us.  It may mean nothing, 
      but we will be exploring the problem.

<end>
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index