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 22:13:29 +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> <42238428 dot 8060205 at rovosoft dot com> <0f35204fee779dbee756a9b64d9ef05f at mobleybros dot com>
Phil M wrote:


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

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


I do not know if this is a fair comparison since the RB CountFields() is case-insensitive. Your test is case-sensitive which would definitely make it faster, but less flexible (if that is what you want).

We're talking countfields... how can countfields be case sensitive or insensitive? Oh wait, hmm I guess... if txtsep was like 'a' or 'A' in a string that contains both. Didn't think of that. No worries for me though as I only use " " or "*" and stuff like that for separators. Then again, it's only in RBScript that I need this, as I use the ElfDataPlugin through out the rest of my code.

Ronald Vogelaar
http://www.rovosoft.com

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