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: Ronald Vogelaar <enter at rovosoft dot com>
Date: Mon, 28 Feb 2005 21:50:48 +0100
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <BE488844 dot 1AD1F%maxduepuntozero at yahoo dot it> <df61ece54e9a636c0043fa7cc1c22abf at mac dot com> <0A92E9E0-89AF-11D9-B0F1-000A957CB4CC at desuetude dot com>
Here's a nice one.

I have created a global function which I use in stead of CountFields:

FastCountFields(txt as string, txtsep as string) as integer
Dim i, j as integer
i=0
j=instrb(txt,txtsep)
while j>0
 i=i+1
 j=instrb(j+1,txt,txtsep)
wend
Return i
End Function


On OSX I found it on average to be about 25% faster than CountFields, on Windows(XP) however, it is on average 300% faster.

In DebugRun on OSX the method was acually slower than CountFields.

Interesting sidenote: just for laughs I also tested ElfDataFields from Theo's ElfData plugin. It is on average 100 times faster than countfields. that's 10,000% faster folks.

Ronald Vogelaar
http://www.rovosoft.com




Charles Yeomans wrote:



On Feb 28, 2005, at 8:28 AM, Thomas Reed wrote:

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

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


That doesn't make any sense... Why should the timing method you use influence the total speed of the test code? I would think this means there's something wrong with the test or the calculations somewhere.


Because the act of calling Microseconds or Ticks affects the code in which it's called. There is a lot of stuff going on at the processor level, most of which I don't understand, that affects execution speed.

--------------
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>


_______________________________________________
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>