[fpc-pascal] Array clearing
pascaldragon at googlemail.com
Sat Apr 1 12:31:25 CEST 2017
Am 01.04.2017 10:35 schrieb "Ryan Joseph" <ryan at thealchemistguild.com>:
> > On Apr 1, 2017, at 2:50 PM, Ryan Joseph <ryan at thealchemistguild.com>
> > Yeah, I was concerned with just compiler types or weakly retained
classes where I’m just keeping the reference.
> Another question. Is it more efficient/faster to reallocate a new array
of the same size or call FillChar on the existing array?
I think that FillChar should be faster as reallocating would need setting
the array to Nil and recreating it (SetLength with the same length won't
touch the existing elements) thus loosing any gain of reallocate and then
there'd still be the internal FillChar of the array.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the fpc-pascal