* * *

Author Topic: Dynamic arrays ...  (Read 1386 times)


  • Jr. Member
  • **
  • Posts: 72
Re: Dynamic arrays ...
« Reply #15 on: June 13, 2018, 05:17:52 am »
Hi Graemejc,
Having a look at TStringList might be a good idea:



  • New member
  • *
  • Posts: 27
  • Automation leads to relaxation...
    • BrainWaveCC Utilities
Re: Dynamic arrays ...
« Reply #16 on: June 17, 2018, 11:34:30 pm »
In my application I am copying large amounts of floats, some 50 million values or  more, from one array to another, performing a simple filter operation; for instance, values outside a certain range are discarded. The target array will therefore be smaller than the original. I started with incrementing the size with each new element copied across, but that became very noticeably slower as the target array grew in size. Blockwise allocation speeded it up quite significantly.

I tested prime numbers up to 50,000,000 and finally saw a measurable difference in performance between pre-allocating the array size to the max likely number...

By the time we get to 50 million (which brings us into the millions of prime numbers), I saw a difference of 5 seconds between starting the array at full size, and starting at 25 elements and growing as needed.    8)
-ASB: https://www.BrainWaveCC.com

Lazarus 1.8.4 (32-bit) + FPC 3.0.4
Windows 10 Pro x64, Version 1803 (Build 17134.5)

(Technically, I logon to these forums from multiple versions of Windows Pro/Enterprise...)



Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus