#1 2019-04-13 12:13:44

mpv
Member
From: Ukraine
Registered: 2012-03-24
Posts: 1,574
Website

Vector capacity growing algorithm for TRawUTF8List

Current capacity growing algorithm for String/Object arrays inside TRawUTF8List is

if result>=capacity then begin
    inc(capacity,256+fCount shr 3);

My application widely use TRawUTF8List to store name-value pairs and minimum capacity of 256 is seams to be too large.

Both C++ vector and FPC TFPList use more flexible algorithms. I'm copy-paste FPC algorithm in #187 pull request and test it with my real use-case (/usr/bin/time myApp)

Current algo:

Maximum resident set size (kbytes): 278840
Minor (reclaiming a frame) page faults: 81035

 

FPC algo:

Maximum resident set size (kbytes): 274920
Minor (reclaiming a frame) page faults: 79774

Memory allocation is better with FPC algorithm.
Benchmark performance is also increased.

@ab  if you don't mind please, merge in #187 pull request into master

Last edited by mpv (2019-04-13 12:14:10)

Offline

#2 2019-04-16 06:17:56

mpv
Member
From: Ukraine
Registered: 2012-03-24
Posts: 1,574
Website

Re: Vector capacity growing algorithm for TRawUTF8List

Offline

Board footer

Powered by FluxBB