realbasic-nug
[Top] [All Lists]

Re: Performance and faster idioms

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: Performance and faster idioms
From: Charles Yeomans <yeomans at desuetude dot com>
Date: Mon, 28 Feb 2005 12:28:50 -0500
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <BE488844 dot 1AD1F%maxduepuntozero at yahoo dot it>

On Feb 28, 2005, at 2:35 AM, Massimo Valle wrote:

on 28-02-2005 1:46, Charles Yeomans wrote:



I tried this and there was essentially no difference in execution time
on my machine; each took at most 1 tick to execute.

The real lesson here is that unless you're doing a lot of iterations,
there is no point to worrying about the difference between If and
Select Case.  If I had code that requires doing a million conditional
blocks, I'd spend my time trying to refactor the code to eliminate the
repeated testing.


I used microseconds to calculate the timing and I continue to get about 3x
speed on if-then. Using ticks I get larger difference: 9x

I agree with you on trying to eliminate the repeated testing, however to see
the performance we must do a repeated testing.
In real world I was able to speed up a lot a graphics drawing routine with
an if-then block in Paint event.

In the end, this is the only testing that really matters. Writing tests is really for rule-of-thumb generation only.

--------------
Charles Yeomans

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>