View Issue Details

IDProjectCategoryView StatusLast Update
0034420FPCFCLpublic2018-11-03 23:56
ReporterAlexey Tor.Assigned ToMichael Van Canneyt 
PrioritynormalSeverityminorReproducibilityN/A
Status resolvedResolutionfixed 
Product Version3.0.4Product Build 
Target VersionFixed in Version3.3.1 
Summary0034420: More memory efficient TDeque.IncreaseCapacity
Descriptionin fcl-stl gdeque:

procedure TDeque.IncreaseCapacity;inline;
...
  if(FCapacity=0) then
    FCapacity:=1
  else
    FCapacity:=FCapacity*2;
  SetLength(FData, FCapacity);
...

in fcl-stl gvector:

procedure TVector.IncreaseCapacity();
begin
  if FCapacity=0 then
    FCapacity:=1
  else
    FCapacity:=FCapacity*2;
  SetLength(FData, FCapacity);
end;

Suggestions:
1) replace simple size*=2 logic with logic.
http://forum.lazarus.freepascal.org/index.php/topic,42852.msg299435.html#msg299435

it increases size by fixed size steps, when data size is huge. It must be not exponential grow (size*=2) for big sizes.
2) 1st step here changed to 4, coz >2 items in deque is often.
3) remove "inline" in both funcs, they will be more complex.
TagsNo tags attached.
Fixed in Revision40214
FPCOldBugId
FPCTarget
Attached Files

Activities

Alexey Tor.

2018-10-15 16:31

reporter   ~0111410

I mean, it is exponential grow in any case, but for big sizes, power of function in made smaller, from 2.0 to 9/8, then to 17/16.

Issue History

Date Modified Username Field Change
2018-10-15 16:25 Alexey Tor. New Issue
2018-10-15 16:31 Alexey Tor. Note Added: 0111410
2018-10-26 10:35 Michael Van Canneyt Assigned To => Michael Van Canneyt
2018-10-26 10:35 Michael Van Canneyt Status new => assigned
2018-11-03 23:56 Marco van de Voort Fixed in Revision => 40214
2018-11-03 23:56 Marco van de Voort Status assigned => resolved
2018-11-03 23:56 Marco van de Voort Fixed in Version => 3.3.1
2018-11-03 23:56 Marco van de Voort Resolution open => fixed