Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Do FunctionName.prg
Message
From
16/05/2021 03:25:17
Walter Meester
HoogkarspelNetherlands
 
 
To
15/05/2021 23:23:07
Mike Yearwood
Toronto, Ontario, Canada
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01680170
Message ID:
01680484
Views:
49
>>>>Why are you arbitrarily storing multiple procedures/functions in a single .prg? This does not help the compiler. If you build separate .prgs per function the exe will run them faster, than if it has to dig into other files first.
>>>
>>>another myth,
>>>
>>>Consider:
>>>
>>>
>>>SET PROCEDURE TO MyFunction3
>>>
>>>nSec = SECONDS()
>>>FOR nT = 1 TO 1000000
>>>	x = Myfunction()
>>>ENDFOR
>>>? "Myfunction, same proc file", SECONDS() - nSec
>>>
>>>nSec = SECONDS()
>>>FOR nT = 1 TO 1000000
>>>	x = Myfunction2()
>>>ENDFOR
>>>
>>>? "Myfunction2,  seperate Prg", SECONDS() - nSec
>>>
>>>nSec = SECONDS()
>>>FOR nT = 1 TO 1000000
>>>	x = Myfunction3()
>>>ENDFOR
>>>? "Myfunction3, set procedure", SECONDS() - nSec
>>>
>>>WAIT window
>>>
>>>FUNCTION MyFunction()
>>>RETURN .T.
>>>
>>>
>>>Outcome (ran as EXE) :
>>>Function in the same source file 0.2 seconds for 1 million calls
>>>Function as PRG exactly the same: 0.2 seconds for 1 million calls
>>>Function as part of procedure file using SET PROCEDURE: 0.185 for 1 million calls.
>>>
>>>There is ABSOLUTELY NOTHING to gain performance wise to split function up into procedures.
>>
>>First, as I just said in another comment, through VFP 6, including a Procedure or Function header in a PRG file that contained only a single routine, had a performance penalty of about an order of magnitude. Ted or I (don't remember which) tested it when writing HackFox.
>>
>>Second, to do a realistic test of what the penalty is today for a procedure file, you'd need to try procedure files of different sizes. I strongly suspect that performance drops as the number of routines increases.
>>
>>Finally, even if there's no performance penalty, procedure files have other negatives, including making it hard to find stuff at design-time (which includes that they can make Thor's Find Definition fail). For me, the worst is that under some circumstances, changes in a procedure file don't show up when you're testing in the IDE. I've been bitten by that a lot.
>>
>>In my view, procedure files stopped having a purpose when the Project Manager was added in FP2. When it's my call, I will always get rid of them. (I wrote a tool to do it, which is now in Thor.)
>>
>>Tamar
>
>Just try to compare code in two procedures in the same library, the jumping from one to the next is a pain. Far easier to open two separate windows.

Ever heard of COPY and PASTE ?
Previous
Reply
Map
View

Click here to load this message in the networking platform