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: "Joseph J. Strout" <joe at realsoftware dot com>
Date: Mon, 28 Feb 2005 16:02:33 -0600
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <20050228210133 dot DCDB7769625 at lists dot realsoftware dot com> <b1bb14210eba2a3e4e9f1e7989481456 at elfdata dot com> <e1b332b5736c36a1c15a2c804bcf5413 at elfdata dot com> <42238F0E dot 1020409 at rovosoft dot com>
At 10:37 PM +0100 2/28/05, Ronald Vogelaar wrote:

Just to make it clear, the reason I doubt that mine is 100x faster, is because countfields doesn't have much room to go wrong. I mean, a simple byte counting loop is hard to beat, and easy to code.

Well, the numbers don't lie.

Sometimes they do -- when the test is written incorrectly. I agree with Theo here, it seems very unlikely that CountFields could be so much faster (though of course is not a simple byte-counting loop, as it is encoding- and case-savvy). The built-in function is very efficient for what it does, even switching to a Boyer-Moore search if the separator string is long enough and in cases where that is possible.

Of course in cases where a binary search would do, then an InStrB loop can indeed be faster.

Best,
- Joe

--
REAL World 2005 - The REALbasic User Conference
March 23-25, 2005, Austin, Texas
<http://www.realsoftware.com/realworld>
_______________________________________________
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>