Statalist The Stata Listserver


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

RE: st: Efficiency of the colon operator in Mata


From   "Ben Jann" <[email protected]>
To   <[email protected]>
Subject   RE: st: Efficiency of the colon operator in Mata
Date   Mon, 22 May 2006 23:12:53 +0200

Bill wrote:
> I remind Ben, we have already discovered that Ben's computer is
> particularly
> slow at running colon operators.  Most computers are not, but a
particular
> older modern of the Intel chip is ...

and Dave asked:
> What version of processor are we talking about?

Of course I did not report timing from the machine Bill was having in
mind (Intel Centrino 1300MHz). The timings I reported were from an Intel
Xenon 3.30GHz (Dell PowerEdge 2850). Furthermore, I obtained similar
timings using an Intel Pentium 4 3.00GHz (Dell Dimension 4600i). (The
timings from the Intel Centrino look quite different as expected.)

Bill continued:
> In any case, whenever Ben can avoid colon operators, he is going to
> observe
> better performance.  The rest of us, however, will not.

Is this really true? I should have phrased my question differently: Is
the colon operator designed so that (almost) no computer time is lost if
it is used in an expression in which it is not really needed? From my
own timings and the timings reported by others it seems that using the
colon operator significantly slows down computations. 

Will this be better if we buy new computers? This is important to me
because if yes, I will not bother to implement special code that does
not use the colon operator unless it is indispensable.

Joseph wrote:
>   And you don't take
> much of a penalty by performing the -if ... else-.  So, it seems to
make
> sense in your case.

Of course my "real" application is much more complicated than the
stylized example. It would be much easier for me to just use the colon
operator and not bother about speed.

ben



*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index