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 16:37:16 -0500
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> <42238428 dot 8060205 at rovosoft dot com>

On Feb 28, 2005, at 3:50 PM, Ronald Vogelaar wrote:

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.

Try testing it when txt and txtSep have different encodings.

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>