| View previous topic :: View next topic |
| Author |
Message |
Thorsten Engler [NexusDB] Guest
|
Posted: Sun Mar 06, 2005 12:47 am Post subject: New benchmark: ArrayUpsizeSingleThread.pas |
|
|
Posted to attachments.
Constantly resize a dynamic array in single steps upward to reproduce
JclDebug behaviour when loading debug information.
Cheers,
Thorsten
|
|
| Back to top |
|
 |
Robert Houdart Guest
|
Posted: Sun Mar 06, 2005 6:32 pm Post subject: Re: New benchmark: ArrayUpsizeSingleThread.pas |
|
|
Hi Thorsten,
I'll add the benchmark to B&V 0.27. In accordance with the suggested rule,
it should also effectively use the memory it allocates. Do you agree with
the following code ?
for i := 0 to 10 * 1024 * 1024 do begin
SetLength(x, i);
x[i - 1] := i;
end;
Cheers,
Robert
|
|
| Back to top |
|
 |
Thorsten Engler [NexusDB] Guest
|
Posted: Sun Mar 06, 2005 10:14 pm Post subject: Re: New benchmark: ArrayUpsizeSingleThread.pas |
|
|
| Quote: | for i := 0 to 10 * 1024 * 1024 do begin
SetLength(x, i);
if i > 0 then
x[i - 1] := i;
end;
|
Cheers,
Thorsten
|
|
| Back to top |
|
 |
Dan Downs Guest
|
Posted: Sun Mar 06, 2005 11:59 pm Post subject: Re: New benchmark: ArrayUpsizeSingleThread.pas |
|
|
Why not just
SetLength(x, 0);
for i := 1 to 10 * 1024 * 1024 do begin
SetLength(x, i);
x[i - 1] := i;
end;
DD
|
|
| Back to top |
|
 |
Thorsten Engler [NexusDB] Guest
|
Posted: Mon Mar 07, 2005 12:22 am Post subject: Re: New benchmark: ArrayUpsizeSingleThread.pas |
|
|
| Quote: | Why not just
SetLength(x, 0);
for i := 1 to 10 * 1024 * 1024 do begin
SetLength(x, i);
x[i - 1] := i;
end;
|
Why did the chicken cross the road?
.....
Works fine for me too...
|
|
| Back to top |
|
 |
Dan Downs Guest
|
Posted: Mon Mar 07, 2005 5:43 pm Post subject: Re: New benchmark: ArrayUpsizeSingleThread.pas |
|
|
| Quote: | Why not just
SetLength(x, 0);
for i := 1 to 10 * 1024 * 1024 do begin
SetLength(x, i);
x[i - 1] := i;
end;
Why did the chicken cross the road?
|
To get rid of the if statement inside the loop. Granted it'll be spending
most of its time resizing x, but maybe, just maybe it'll save enough time to
fry up that chicken. <g>
DD
|
|
| Back to top |
|
 |
|