Special

Clearance Sale!

We've been publishing for over five years now and it's time to clear out our inventory of back issues, so we're slashing prices!

RBD Magazines

Check out this amazing clearance sale of all our past issues. Missing some issues? This is a great time to complete your RBD collection. Save up to 40% off the regular price of our printed back issue packages. These prices are only good until the end of the year May 2008 and supplies are limited, so place your order today.

Article Preview


Buy Now

Print:
PDF:

Optimizing REALbasic

Optimizing REALbasic

Optimizing with Stock Replacements

Issue: 4.3 (January/February 2006)
Author: Hank Marquis
Article Description: No description available.
Article Length (in bytes): 10,783
Starting Page Number: 40
RBD Number: 4319
Resource File(s): None
Related Web Link(s):

http://www.extremeoptimizing.com
http://www.slayfire.com
http://www.itl.nist.gov/div898/handbook/prc/section1/prc13.htm
http://davidmlane.com/hyperstat/A28521.html
http://www.its.bldrdoc.gov/fs-1037/dir-001/_0125.htm

Known Limitations: None

Excerpt of article text...

To optimize performance you must have a way of comparing two code blocks to see which method is faster. This article is part one of a three part series in which we will create a measuring system that provides statistically valid performance data. The "test harness" we build will be accurate, precise, and yield repeatable values about which you may feel confident.

The best way to explain how to compare code execution speed is by describing the incorrect method so many developers think they can use for optimization -- the Microseconds keyword. Many developers think optimization is as simple as follows:

Save Microseconds current value (Start)

Doing something interesting

Save Microseconds current value (Stop)

Subtract the Start from the Stop to get the Elapsed time

Listing 1 shows some code implementing the above (flawed) logic.

Listing 1: (How Not To) Time Code Excution

Function Foo(lb As ListBox) As Double

Dim i As Integer

Dim r As Integer

Dim dStart As Double

Dim dStop As Double

...End of Excerpt. Please purchase the magazine to read the full article.

Article copyrighted by REALbasic Developer magazine. All rights reserved.


 


|

 


Weblog Commenting and Trackback by HaloScan.com