Re: Boolean logic on strings?
From: Jim Mack (jmack_at_mdxi.nospam.com)
Date: 11/16/04
- Next message: Randy Birch: "Re: right way to call a form?"
- Previous message: Klaus H. Probst: "Re: Feedback on recursive file search..."
- In reply to: Larry Serflaten: "Re: Boolean logic on strings?"
- Next in thread: Larry Serflaten: "Re: Boolean logic on strings?"
- Reply: Larry Serflaten: "Re: Boolean logic on strings?"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 15 Nov 2004 20:40:35 -0500
Larry Serflaten wrote:
> "Jim Mack" <jmack@mdxi.nospam.com> wrote
>> In addition to what others have suggested, that you do this one
>> character at a time, I would suggest that you first convert the
>> strings to byte arrays. Looping through the byte arrays should be
>> much faster than looping over the strings. Air code:
>
> That method has been shown to be slower than just looping through
> the string for a similar task. Something like 1.5 years ago we had a
> long discussion here on a method to do some string manipulations
> (I forget the exact task) and I was going to submit a byte array
> method, but by the time the strings are copied for use, and then
> copied back for output, the advantage of working with numbers is lost
> when compared with just using Mid to get at the individual characters.
>
> As always, however, actual performance testing should be done to
> verify which is the more performant method in this case....
>
> LFS
Larry -
I didn't time it, and on reflection I wouldn't do it exactly like that.
Instead:
BytX() = x$
BytY() = y$
for idx = 0 to ubound(BytX) Step 2
BytX(idx) = ((BytX(idx) and 1) Or (BytY(idx) and 1)) + &h30
next
z$ = BytX()
This can avoid Unicode conversion because all the characters are low
Ascii.
This is the version I'd time. I have to believe that at some point
(length) the overhead of all the Mid$ would be a killer.
--
Jim
- Next message: Randy Birch: "Re: right way to call a form?"
- Previous message: Klaus H. Probst: "Re: Feedback on recursive file search..."
- In reply to: Larry Serflaten: "Re: Boolean logic on strings?"
- Next in thread: Larry Serflaten: "Re: Boolean logic on strings?"
- Reply: Larry Serflaten: "Re: Boolean logic on strings?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|