Re: String Functions
- From: "Pierre le Riche" <pleriche@xxxxxxxxxxx>
- Date: Sat, 30 Apr 2005 21:54:34 +0200
Hi John,
> Here is my test program and some results under
> D5 and D7. The results seem about the same with
> optimization $O+ and $O-.
Two mistakes in your benchmark:
(1) You do not reset the result string (s) back to blank before calling each
function. This means that the SetLength call doesn't do the same thing in
all functions. In fact, after my function the SetLength in yours does
nothing, since the length is already set correctly. Exchange the order of
the calls by putting yours first and you'll see the dramatic difference it
makes. Also, by the time it gets to the thrid test function the memory used
by 's' is cached and it runs much faster.
(2) One iteration is not anywhere near enough. We're talking an execution
time of a few microseconds here.
If I add the line
s := ''
before each benchmark, and I increase the benchmark count to a few thousand
I get repeatable results which bear out the results of my previous post.
Regards,
Pierre
.
- References:
- String Functions
- From: Chekcin
- Re: String Functions
- From: Dennis
- Re: String Functions
- From: Florent Ouchet
- Re: String Functions
- From: John Herbster
- Re: String Functions
- From: Florent Ouchet
- Re: String Functions
- From: John Herbster
- Re: String Functions
- From: ffz
- Re: String Functions
- From: Pierre le Riche
- Re: String Functions
- From: John Herbster
- String Functions
- Prev by Date: Re: String Functions
- Next by Date: Re: String Functions
- Previous by thread: Re: String Functions
- Next by thread: Re: String Functions
- Index(es):
Relevant Pages
|