[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: Efficiency of the colon operator in Mata
I find the same pattern in my AMD xp2700 chip -- admittedly fairly old, but
certainly not by Intel. The colon operator takes twice as long as the
----- Original Message -----
From: "William Gould, Stata" <firstname.lastname@example.org>
Sent: Monday, May 22, 2006 11:23 AM
Subject: Re: st: Efficiency of the colon operator in Mata
Ben Jann <email@example.com> did some speed tests in Mata
and diiscovered that
if (length(k)==1) y = x * k
else y = x :* k
is faster than
y = x :* k
(In Ben's code, k is a vector or scalar).
I remind Ben, we have already discovered that Ben's computer is
Can anyone confirm these results? Is it true that the colon operator
significantly slows down computations if used in situations where it is
not really needed or is this just an artifact produced by my local
slow at running colon operators. Most computers are not, but a particular
older modern of the Intel chip is, and we have duplicated the behavior
We at StataCorp even know how to get around the problem, but our concern
that the fix will cause modern computers to run colon operators slower.
said we would test, but we have not completed that yet.
In any case, whenever Ben can avoid colon operators, he is going to
better performance. The rest of us, however, will not.
* For searches and help try: