Best practice for performance testing

Dar Scott dsc at
Thu Sep 15 11:59:29 EDT 2011

I don't know about best practice.  Here are some thoughts.

If I suspect some particular section of code, I bracket it with timing scripts.  If your problem is on the order of 2 seconds, then you can call a handler before and a hander afterward.  The first saves the long seconds and the second gets it again and reports the difference, say, in the message box.  For very short timing, I put the script inline.

I often build bottom-up with test buttons for interesting handlers.  I usually add timing code that update a field as I go so I have a heads-up as I build.

Perhaps you can find some suspects by typing control-period during debugging a few times.  It will tend to stop in the handlers that take the most time.  

Since you develop on OS X and test on Windows, you might see cached values on the Mac but a single test runs longer on Windows since those are not cached.  Test more than once in an environment.  

When examining your code, look for loops.  Much of the time will be here, though I don't know why it would be different for Windows.  Also, at one time, time resolution was an issue for Windows, but I suspect that is not an issue any more.

Try some competing application that you feel sets a good standard.  See if it has the same issue.  

I work in my own little corner so I can easily miss what best practice is.  Perhaps best practice is asking RunRev for profiling, a timing analysis tool.  


On Sep 15, 2011, at 5:40 AM, Andrew Henshaw wrote:

> Hi,
> Ive got an application that quite happily runs along at an acceptable speed on my Macs,  but on Windows systems it seems to struggle.
> Im trying to pin down the parts of the code that I need to look at so I can work out what is happening.  My best guess would be the interaction with the sqllite database,  but thats just a guess!
> Does anyone have any suggestions as to the best way to do this.
> Im thinking of writing a command I can call to simple log some text and the milliseconds to a file,  so I can insert calls to the command through the various code and track exactly what time each are called,  but something in the back of my head says this might not be the best solution as the file write will also take time.
> Is there a best practice way to do something like this,  im afraid I started life programming on a Sinclair ZX80 and my skills have probably not progressed much!!
> Andy
> _______________________________________________
> use-livecode mailing list
> use-livecode at
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:

Dar Scott
Dar Scott Consulting
8637 Horacio Place NE
Albuquerque, NM 87111

Lab, home, office phone: +1 505 299 9497
For Skype and fax, please contact.
dsc at

Computer Programming and tinkering,
often making LiveCode libraries and
externals, sometimes writing associated
microcontroller firmware.  

More information about the Use-livecode mailing list