From | "Michael Blasnik" <[email protected]> |
To | "Michael Blasnik" <[email protected]>, <[email protected]> |
Subject | Re: st: -stylerules- updated on SSC |
Date | Thu, 14 Apr 2005 08:40:37 -0400 |
In my experience, the trade-off in execution time between preserve / restore and a series of if `touse' statements can reach the tipping point fairly quickly. I find that about 10 (+-5) -if `touse'- statements requires about as much time as one set of preserve/ drop if `touse'/restore in fairly large datasets (in small datasets, it matters less). So a programmer may want to look at the preserve, drop if !`touse', restore approach if there are more than about 10 -if `touse' lines that need to be executed. These timings are for a machine where temp files are written to the local hard drive. In practice, I tend to avoid the preserve/restore approach unless the speed advatage is clear (perhaps 20+ if `touse ' lines).
Michael Blasnik
[email protected]
----- Original Message ----- From: "Roger Newson" <[email protected]>
To: <[email protected]>
Sent: Thursday, April 14, 2005 7:19 AM
Subject: Re: st: -stylerules- updated on SSC
Re Point 1, file input and output is usually MUCH more time-consuming than in-memory operations such as checking `touse'. However, re Point 2, Richard is right, and a block of code which modifies the data *permanently* should indeed start with a single -preserve- and end with a single -restore, not-, just in case the user presses -break-.
Roger
* * 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 |