Statalist The Stata Listserver


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

st: efficiency (or lack thereof) of the colon operator


From   Kit Baum <baum@bc.edu>
To   statalist@hsphsun2.harvard.edu
Subject   st: efficiency (or lack thereof) of the colon operator
Date   Mon, 22 May 2006 17:58:42 -0400

The speed differential has been reported for Intel and AMD. It is not limited to that platform:

(1) on a fairly old PowerPC G4 chip,

. mata: x=uniform(10000,1)
r; t=0.04 17:48:27

. mata: for(i=1;i<=10000;i++) y=x*1
r; t=5.75 17:48:52

. mata: for(i=1;i<=10000;i++) y= x:*1
r; t=10.32 17:49:25


(2) On a newer PowerPC G5,

. mata: x=uniform(10000,1)
r; t=0.01 17:51:55

. mata: for(i=1;i<=10000;i++) y=x*1
r; t=2.33 17:52:06

. mata: for(i=1;i<=10000;i++) y= x:*1
r; t=5.89 17:52:18


and
(3) on a quite old Sun SPARC processor, the colon operator is realllllly slow--

. mata: x=uniform(10000,1)
r; t=0.08 17:50:28

. mata: for(i=1;i<=10000;i++) y=x*1
r; t=6.49 17:50:39

. mata: for(i=1;i<=10000;i++) y= x:*1
r; t=26.44 17:51:10



Kit Baum, Boston College Economics
http://ideas.repec.org/e/pba1.html


*
* 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