Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: performance improvement with compiled code


From   rgutierrez@stata.com (Roberto G. Gutierrez, StataCorp.)
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: performance improvement with compiled code
Date   Mon, 07 Jul 2003 09:31:52 -0500

Shige Song <sgsong@park.ccpr.ucla.edu> asks:

> Has anyone done any benchmark tests on the performance gain by using the
> newly introduced compiled code plugin in Stata 8.1? I am really curious to
> know how big the difference it can make. Thanks!

This is VERY problem dependent.  The biggest speed-up's are typically obtained
when you use a plugin to replace lots of interpreted lines of ado code.  For
example, replacing a loop over the observations with a plugin is almost always
a good idea.

To give you a feel for how much speed can be gained, I recently wrote a
program to perform local polynomial regression.  The program loops over the
observations in a smoothing grid (which can be as large as _N).  For each
iteration of the loop, it forms the terms of a k-th order polynomial, runs a
k-th order polynomial regression, and saves off the estimated intercept from
this regression.

In my case, replacing the loop with a plugin resulted in code that ran
anywhere from 4 to 10 times faster, depending on _N and k.

--Bobby
rgutierrez@stata.com
*
*   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