On 02/04/17 11:22, Ryan Joseph wrote:
On Apr 1, 2017, at 9:25 PM, Jürgen Hestermann <juergen.hesterm...@gmx.de> wrote:

If you just need to reuse the same array and only need to zero its elements
then of course fillchar would be the fastest approach (it saves the memory
reallocation step).
Why is this “of course”? What’s the implementation of FillChar exactly? For all 
I know it has to iterate over a range of bytes and this could be slower than 
allocation of memory. Maybe some of the compiler people know these details.

Allocating new memory via setlength also clears the memory (+ the overhead of allocating the memory).


Jonas
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to