Your full service technology partner! 
-Collapse +Expand
Search Paradox Group:

-Collapse +Expand Paradox To/From
-Collapse +Expand Paradox Store

Prestwood eMagazine

May Edition
Subscribe now! It's Free!
Enter your email:

   ► KBDesktop Data...Paradox & Ob...ObjectPAL Co...OPAL: Commands   Print This     
  From the February 2010 Issue of Prestwood eMag
Paradox OPAL: Commands:
Testing the Speed of Your code
Posted 11 years ago on 6/5/2008
Take Away: To test the speed of your code, capture the time before and after your code executes and view the milliseconds between the two dates.


Because there are many ways in ObjectPAL to accomplish a given task, you often need to test the speed of two routines. ObjectPAL offers, in the form of the time() method, an easy way to do this. To calculate the amount of time a scan loop takes on the CUSTOMER table, type in lines 3-19 into the ushbutton event of a button:

 1: ;DATATYPE :: btnSpeed :: pushbutton
 2: method ushbutton(var eventInfo Event)
 3: var
 4:   tcCustomer  Tcursor
 5:   tBeg, tEnd  Time
 6:   nDifftime   Number
 7: endVar
 9:"CUSTOMER.DB")   ;Open CUSTOMER.DB table.
11: tBeg = time()  ;Grab current time.
12: scan tcCustomer:
13:   ;Nothing here. Just testing scan time.
14: endScan
15: tEnd = time()  ;Grab current time.
17: ;The following calculates the number of milliseconds that passed.
18: nDiffTime = number(tEnd) - number(tBeg)
19: nDiffTime.view("Milliseconds to scan Customer table")
20: endMethod

The preceding routine opens the CUSTOMER table, gets the current time, scans the CUSTOMER table, and then gets the current time again. Finally, it calculates the duration of the scan loop and displays it in milliseconds. Use the preceding technique whenever you need to know how fast a routine is in ObjectPAL-for example, when you discover two ways to accomplish the same task and need to determine which is faster.

More Info

Tip:  Speed Up TCursors with setBatchOn()

Linked Message Board Threads

 BIG problem with speed of application. Very URGENT in ObjectPAL MB Topic (14 replies)
 Improving speed when moving form to form. in ObjectPAL MB Topic (7 replies)
 Increase query speed in ObjectPAL MB Topic (4 replies)


Share a thought or comment...
Write a Comment...
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.

Anonymous Post (text-only, no HTML):

Enter your name and security key.

Your Name:
Security key = P1202A1
Enter key:
KB Post Contributed By Mike Prestwood:

Mike Prestwood is a drummer, an author, and creator of the PrestwoodBoards online community. He is the President & CEO of Prestwood IT Solutions. Prestwood IT provides Coding, Website, and Computer Tech services. Mike has authored 6 computer books and over 1,200 articles. As a drummer, he maintains and has authored 3 drum books. If you have a project you wish to discuss with Mike, you can send him a private message through his PrestwoodBoards home page or call him 9AM to 4PM PST at 916-726-5675 x205.

Visit Profile

 KB Article #101163 Counter
Since 6/5/2008
Go ahead!   Use Us! Call: 916-726-5675  Or visit our new sales site:

©1995-2019 Prestwood IT Solutions.   [Security & Privacy]