Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Argument starter - The roots of all evil
Message
From
13/09/2004 07:18:24
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00938079
Message ID:
00941557
Views:
38
>Cetin,
>
>You never have to use PMFJI. We've been friends for too long for you to have to use that.< s >
>
>To answer you're question...I don't know. It might be faster with one of the "evils", but by how much? IOW, would it really make a significant difference? I don't think so.
>
>Regards,

Thanks friend,
As this thing turned out to be an academic thing I made a test with multiple RETURNs version and it was around 50% faster.
It was beaten by Walter's highly clever approach:) Very nice code Walter.

A code like that would be optimized in case it'd be called n thousand times. Otherwise a plain vanilla for...exit...endfor would do and it wouldn't expect a sorted array nor you'd not only get back only a found @ but might request first or last occurence, right? If so I've around 7-8 times faster code than Walter's but I simply assumed it'd be called at least n thousand times and made a little one time preparation (cheated IOW and put the array in a cursor and indexed, BTW in all tests I added a nSearchCol for a multicol array - out of competition I accept:)

The question was multiple RETURNs, EXIT are evils or not. To me they're not and when makes sense they should be used (in my daily coding they make sense often:).

Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform