realbasic-nug
[Top] [All Lists]

Re: Performance and faster idioms

To: realbasic-nug at lists dot realsoftware dot com
Subject: Re: Performance and faster idioms
From: "Theodore H.Smith" <delete at elfdata dot com>
Date: Mon, 28 Feb 2005 21:22:16 +0000
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <20050228210133 dot DCDB7769625 at lists dot realsoftware dot com>
From: Ronald Vogelaar <enter at rovosoft dot com>

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.

Faster than countfields? I'd actually doubt it myself, to be honest. I'll probably test this at somepoint, however. Just to make sure. It may be that this result you got only applies in certain cases.

I suppose you did this:

while fi.MoveNext
        Count = Count + 1
wend

By the way, your "FastCountFields" could be implemented using my plugin... no problem there. You could even make it use a string param if you like. I think one operator_convert won't hurt when its not in the hot loop.

Avoiding Operator_convert in a hot loop is where most users can speed up their use of my plugin.

--
   Theodore H. Smith - www.elfdata.com/plugin/ - www.elfdata.com/forum/
   ElfData: Industrial strength string processing, made easy.
"All things are logical. Putting free-will in the slot for premises in
a logical system, makes all of life both understandable, and free."

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