D code optimization
thedeemon via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Sep 22 10:22:54 PDT 2016
On Thursday, 22 September 2016 at 16:09:49 UTC, Sandu wrote:
> const int n = 252;
> double[] call = new double[n+1];
> ...
> //delete call; // since D is has a garbage collector,
> explicit deallocation of arrays is not necessary.
If you care about speed, better uncomment that `delete`. Without
delete, when allocating this array 10000 times you'll trigger GC
multiple times without good reason to do so. With delete, the
same memory shall be reused and no GC triggered, run time should
be much better.
More information about the Digitalmars-d-learn
mailing list