View Issue Details

IDProjectCategoryView StatusLast Update
0034420FPCFCLpublic2021-01-06 20:06
ReporterCudaText man Assigned ToMichael Van Canneyt  
PrioritynormalSeverityminorReproducibilityN/A
Status closedResolutionfixed 
Product Version3.0.4 
Fixed 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

Relationships

parent of 0038306 resolvedMichael Van Canneyt gqueue unit memory access error 

Activities

CudaText man

2018-10-15 14: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 14:25 CudaText man New Issue
2018-10-15 14:31 CudaText man Note Added: 0111410
2018-10-26 08:35 Michael Van Canneyt Assigned To => Michael Van Canneyt
2018-10-26 08:35 Michael Van Canneyt Status new => assigned
2018-11-03 22:56 Marco van de Voort Fixed in Revision => 40214
2018-11-03 22:56 Marco van de Voort Status assigned => resolved
2018-11-03 22:56 Marco van de Voort Fixed in Version => 3.3.1
2018-11-03 22:56 Marco van de Voort Resolution open => fixed
2019-12-16 11:06 CudaText man Status resolved => closed
2021-01-06 20:06 Sven Barth Relationship added parent of 0038306