| |
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: RE: processing time
I think dropping both in one step is faster:
Profiler results:
both
99 75.021 both
Overall total count = 99
Overall total time = 75.021 (sec)
separate
99 96.438 separate
Overall total count = 99
Overall total time = 96.438 (sec)
-------------- Begin do file -------------------
#delimit;
version 9.2;
capture program drop _all;
clear;
set mem 100m;
set seed 12345;
set obs 1000000;
local tests 100;
gen a = uniform(); qui replace a = . if a > 0.5;
gen b = uniform(); qui replace b = . if b > 0.5;
program define both;
preserve;
quietly drop if a == . | b == .;
restore;
end;
program define separate;
preserve;
quietly drop if a == .;
quietly drop if b == .;
restore;
end;
profiler on;
local i = 1;
while `i' < `tests' {;
both;
local i = `i' + 1;
};
profiler off; profiler report; profiler clear;
profiler on;
local i = 1;
while `i' < `tests' {;
separate;
local i = `i' + 1;
};
profiler off; profiler report; profiler clear;
-------------- End do file -------------------
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Jon Schwabish
Sent: Thursday, March 22, 2007 12:55 PM
To: [email protected]
Subject: st: processing time
Quick question:
Which is more efficient (in terms of processing time)?
drop if a==.
drop if b==.
OR
drop if a==. | b==.
(where a and b are any variables of choice).
Thanks.
________________________________________________________________________
____________
Don't pick lemons.
See all the new 2007 cars at Yahoo! Autos.
http://autos.yahoo.com/new_cars.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/
_____________________________________________________________
This e-mail and any attachments may be confidential or legally privileged. If you received this message in error or are not the intended recipient, you should destroy the e-mail message and any attachments or copies, and you are prohibited from retaining, distributing, disclosing or using any information contained herein. Please inform us of the erroneous delivery by return e-mail.
Thank you for your cooperation.
_____________________________________________________________
*
* 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/