Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Multiple procedures vs. one procedure - revisited
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01022173
Message ID:
01023276
Views:
11
>Hi Nadya,
>
>Here is a small example:
>
>LPARAM lcOut
>CLEAR
>LOCAL lii,liy,lihFile,lcFile,lcKey,lcCrap,lcFFile
>#DEFINE MaxFiles 100
>#DEFINE MaxFunc  100
>
>IF !DIRECTORY(lcOut)
>   MD (lcOut)
>ENDIF
>
>
>IF RIGHT(lcOut,1)#"\"
>   lcOut=lcOut+"\"
>ENDIF
>
>DELE FILE (lcOut+"*.*")
>
>lcCrap=""
>FOR lii=1 TO 500
>    lcCrap=lcCrap+"?PROGRAM()"+CHR(13)+CHR(10)
>NEXT
>
>FOR lii=1 TO MaxFiles
>    lcKey="X"+SYS(2015)
>    lcFile=lcOut+lcKey+".prg"
>    WAIT WIND STRTRAN("File %File% is in progress...","%File%",lcFile) NOWAIT
>    lihFile=FCREATE(lcFile)
>    IF lihFile>0
>       FOR liy=1 TO MaxFunc
>           =FPUTS(lihFile,"PROCEDURE "+lcKey+"_"+LTRIM(STR(liy,11)))
>           =FPUTS(lihFile,lcCrap,LEN(lcCrap))
>           =FPUTS(lihFile,"ENDPROC")
>           =FPUTS(lihFile,"")
>       NEXT
>       IF lii=MaxFiles
>          =FPUTS(lihFile,"PROCEDURE Test_Procedure")
>          =FPUTS(lihFile,"?PROGRAM()")
>          =FPUTS(lihFile,"ENDPROC")
>          =FPUTS(lihFile,"")
>       ENDIF
>
>       IF lii=1
>          =FPUTS(lihFile,"PROCEDURE FTest_Procedure")
>          =FPUTS(lihFile,"?PROGRAM()")
>          =FPUTS(lihFile,"ENDPROC")
>          =FPUTS(lihFile,"")
>          lcFFile=lcFile
>       ENDIF
>
>       =FCLOSE(lihFile)
>
>       COMPILE (lcFile)
>       SET PROCEDURE TO (lcFile) ADDITIVE
>    ENDIF
>NEXT
>
>
>t1=SECO()
>Test_Procedure()
>t2=SECO()
>?"Call time - Last function:",t2-t1,"s"
>
>t1=SECO()
>DO Test_Procedure IN (lcFile)
>t2=SECO()
>?"Call time - Last DO:",t2-t1,"s"
>
>
>t1=SECO()
>Test_Procedure()
>t2=SECO()
>?"Call time - First function:",t2-t1,"s"
>
>t1=SECO()
>DO FTest_Procedure IN (lcFFile)
>t2=SECO()
>?"Call time - First:",t2-t1,"s"
>
>SET PROCEDURE TO
>
>WAIT CLEAR
>
>
>
>I got result: all times was less then 100 ms
>
>MartinJ
>

Sorry for not replying earlier. I guess I did something else wrong, because now everything is quick enough again.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform