Board index » delphi » Fastcode Next String Challenge

Fastcode Next String Challenge


2005-03-01 10:19:39 PM
delphi15
Hi
I have asked this question before but forgotten the conclusion.
I would like to start a string based challenge. Which function do you want
the most to be optimized?
Best regards
Dennis
 
 

Re:Fastcode Next String Challenge

"Dennis" <XXXX@XXXXX.COM>writes
Quote
I would like to start a string based challenge. Which function do you want
the most to be optimized?
In-place concatenation ;)
 

Re:Fastcode Next String Challenge

:)
In-place concatenation, copy, delete and matching without copy.
Example:
if Copy(MyString,5,3)='OK' then
need become: if MatchWithoutCopy(MyString,5,3,'OK')=0 then ...
This will speedup a lot of useless copy mem operation.
I already did these routine for mine RTL, and the speed gain worth the
implementation.
I suggest also to build a Unicode lookup table for fastest UPPERCASE
LOWERCASE.
Cheers.
Roby
"Frank" <XXXX@XXXXX.COM>ha scritto nel messaggio
Quote
"Dennis" <XXXX@XXXXX.COM>writes
news:XXXX@XXXXX.COM...

>I would like to start a string based challenge. Which function do you
>want
>the most to be optimized?

In-place concatenation ;)

 

Re:Fastcode Next String Challenge

Dunno if it is off-topic in a string challenge, but TStrings.CommaText,
Text and other DelimitedText getters/setters could use some speedup.
Eric
 

Re:Fastcode Next String Challenge

Eric Grange writes:
Quote
Dunno if it is off-topic in a string challenge, but TStrings.CommaText,
Text and other DelimitedText getters/setters could use some speedup.

Eric
How about just a TStringList challange.
 

Re:Fastcode Next String Challenge

Hi All
TStringList is a much wanted challenge and I think we should do it soon.
But I'd like to make a simple string challenge first.
Regards
Dennis
 

Re:Fastcode Next String Challenge

Hi Eric and all
Quote
A full TStringList challenge might a a bit too far reaching IMHO
(too many functions at once), might be preferable to break it down
along more specific functionality and assemble everything later on?
Yes I agree on that. I'd personally like to do a .Sort challenge first.
Quote
Eric
Regards
Dennis
 

Re:Fastcode Next String Challenge

Quote
How about just a TStringList challange.
Yep, IndexOf, IndexOfName, Values[] and the rest could also use
some serious improvement (though the TStrings structure makes
it difficult to improve them cleanly in some cases).
A full TStringList challenge might a a bit too far reaching IMHO
(too many functions at once), might be preferable to break it down
along more specific functionality and assemble everything later on?
Eric
 

Re:Fastcode Next String Challenge

Eric Grange writes:
Quote
>How about just a TStringList challange.

Yep, IndexOf, IndexOfName, Values[] and the rest could also use
some serious improvement (though the TStrings structure makes
it difficult to improve them cleanly in some cases).
A full TStringList challenge might a a bit too far reaching IMHO
(too many functions at once), might be preferable to break it down
along more specific functionality and assemble everything later on?

Eric
A full challenge would allow people to change the entire *inner*
workings of TStringList. They could implement it with a hash, a tree,
or a list.
Also what happens when one person wins .Sort and another person wins
.IndexOfName and they are not compatiable with each other.
The B&V can test all the functions of TStringList giving weighting to
each one. If a person thinks they can win by only improving some of the
functions then they are free to do that.
 

Re:Fastcode Next String Challenge

Hi
What about string comparison?
We have StrComp, but no StrIComp, but I think that PChar functions are less
important than AnsiString functions.
What do you think of
CompareStr?
AnsiCompareStr?
SameText?
Regards
Dennis
 

Re:Fastcode Next String Challenge

I suggested a few weeks ago an AnsiCompareStr challenge. Since it appears
to be the main bottleneck of TStringlist Sort, Indexof, and Find operation,
then it could be a good candidate for a first attempt to opmitize
TStringlist operations. However, someone suggested that since this
procedure spend most of its time doing locale-specific things, there isn't
very much one can do about its performance.
Richard
"Dennis" <XXXX@XXXXX.COM>writes
Quote
Hi All

TStringList is a much wanted challenge and I think we should do it soon.

But I'd like to make a simple string challenge first.

Regards
Dennis


 

Re:Fastcode Next String Challenge

My vote goes for TStringList - Like MM Challenge, TStringlist
is very often used and RTL implementation is very slow,
Juhani Suhonen
"Joe Bain" <XXXX@XXXXX.COM..c.o.m>writes
Quote
Eric Grange writes:

>Dunno if it is off-topic in a string challenge, but TStrings.CommaText,
>Text and other DelimitedText getters/setters could use some speedup.
>
>Eric

How about just a TStringList challange.
 

Re:Fastcode Next String Challenge

Juhani Suhonen writes:
Quote
My vote goes for TStringList - Like MM Challenge, TStringlist
is very often used and RTL implementation is very slow,

First, scuse for my english, I am french :)
Also, TStringList is too slow !!
IndexOf method can optimized in a few minute.
For example : my method is 4 more fast than RTL !
All in pascal and without specific optimization.
You're a very good group.
I have discovered BASM since 2 weeks and optimize all can i.
I did a pos with Boyer-Moore method if you can interest, in BASM and 4
more fast than pos without specific instructions.
MyIndexOf method :
Chaine = String in french
function NewIndexOf(Liste: TStrings; Chaine: string): integer;
var
Lignes, Cpt, i : integer;
Car1 : Char;
begin
Lignes := Liste.Count;
Car1 := Chaine[1];
Result := -1;
For i:=0 to Lignes-1 do
begin
if Liste.Strings[i][1] = Car1 then
begin
if CompareStr(Liste.Strings[i], Chaine) = 0 then
begin
Result := i;
Break;
end;
end;
end;
end;
 

Re:Fastcode Next String Challenge

I second the TStringList challenge, extremely useful for all Delphi
developers.
It presents the same benchmarking difficulties as the MM challenge, though.
A lot of work will go in designing the right benchmarks, making them fair
and reasonably real-world, balancing between Sorting, IndexOf, Values,
CommaText etc.
Like for the MM challenge, constructing the benchmark system will be more
difficult than writing the actual code for the entry :-)
Robert
"Juhani Suhonen" <XXXX@XXXXX.COM>writes
Quote
My vote goes for TStringList - Like MM Challenge, TStringlist
is very often used and RTL implementation is very slow,


Juhani Suhonen


"Joe Bain" <XXXX@XXXXX.COM..c.o.m>writes
news:XXXX@XXXXX.COM...
>Eric Grange writes:
>
>>Dunno if it is off-topic in a string challenge, but TStrings.CommaText,
>>Text and other DelimitedText getters/setters could use some speedup.
>>
>>Eric
>
>How about just a TStringList challange.


 

Re:Fastcode Next String Challenge

Hi Richard
Quote
I suggested a few weeks ago an AnsiCompareStr challenge. Since it appears
to be the main bottleneck of TStringlist Sort, Indexof, and Find
operation,
then it could be a good candidate for a first attempt to opmitize
TStringlist operations. However, someone suggested that since this
procedure spend most of its time doing locale-specific things, there isn't
very much one can do about its performance.
I will take a look at it. It looks like the way to go.
Quote
Richard
Regards
Dennis