efficiency of various equivalent tests
Brian K. White
brian at aljex.com
Mon Jul 7 13:47:41 PDT 2008
Probably a Ken question, or I guess one could do an emprical test on an otherwise idle box.
Which way causes fp to do less, or faster, work at run-time?
"and list"
A) If: aa eq "" and bb eq "" and cc eq ""
B) If: aa{bb{cc{"" eq ""
"or list"
A) If: aa eq "" or bb eq "" or cc eq ""
B) If: "|"{aa{"|"{bb{"|"{cc{"|" co "||"
The or-list doesn't look shorter or simpler to write the 2nd way in this small example, but in both cases the 2nd way can be a large list and the list can be assembled dynamically. But I wonder if the test were to take place very often in a loop or in a report that touches all records etc, would it be worthwhile to do things the 1st way sometimes.
Also this isn't necessarily about testing for empty, that also is just an example.
Brian K. White brian at aljex.com http://www.myspace.com/KEYofR
+++++[>+++[>+++++>+++++++<<-]<-]>>+.>.+++++.+++++++.-.[>+<---]>++.
filePro BBx Linux SCO FreeBSD #callahans Satriani Filk!
More information about the Filepro-list
mailing list