Wiki Roadmap Timeline Tickets New Ticket Source Search Help / Guide About Trac Login

Ticket #343 (new defect)

Opened 3 years ago

Last modified 2 years ago

array append should use _d_arrayappendT

Reported by: fawzi Assigned to: lindquist
Priority: major Milestone:
Component: backend Version: hg tip
Keywords: Cc:

Description

at the moment ldc always uses _d_arraysetlengthT, but when you are growing the array you know that it was too small, and so it makes sense to expect that it will grow again, and thus allocate a little bit of extra space (something that does not make so much sense in _d_arraysetlengthT, as it would likely increase the wasted space without a good improvement in performace.

This change can improve the appending performance for large arrays, log(N) appends for linear append of N elements, while reducing the wasted space when the array is very large, due to the smart growing function.

Change History

07/16/09 08:52:23 changed by fawzi

these functions are in lifetime.d, and at the moment commented out. take care that the growing function in 0.99.8 was buggy, and could lead to huge allocations.

02/15/10 10:30:05 changed by llucax

Is this somehow related to r1633?

02/15/10 14:02:31 changed by ChristianK

  • owner changed from ChristianK to lindquist.
  • component changed from unspecified to backend.

Yes, it's half of it. T[] ~ T[] still uses compiler generated code instead of the runtime call.

Copyright © 2008, LDC Development Team.