Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Ticket #418 (closed enhancement: fixed)

Opened 5 years ago

Last modified 5 years ago

ArraySeq growth without copy [patch]

Reported by: pmfp Assigned to: kris
Priority: major Milestone: 0.98 RC 2
Component: Tango Version: trunk
Keywords: patch, ArraySeq Cc:

Description

Affected file: 0.97/tango/util/collection/ArraySeq.d

When the ArraySeq?(T) grows beyond allocated size, it currently creates a new array and copies all old contents to it.

This patch uses ~= to expand the original array instead. It has been tested in a separate program where an array was created and filled with 65 million entries. Additional elements were then added near the beginning, by first resizing the array, moving elements, and then assigning the value. The speed increase between this method and a copy is on the order of magnitude.

HTH Martin Persenius

Attachments

ArraySeq-growth.patch (1.2 kB) - added by pmfp on 04/19/07 11:13:36.

Change History

04/19/07 11:13:36 changed by pmfp

  • attachment ArraySeq-growth.patch added.

04/19/07 14:28:09 changed by kris

  • status changed from new to closed.
  • type changed from task to enhancement.
  • component changed from Core Functionality to Tango.
  • version changed from 0.97 RC1 to trunk.
  • milestone set to 0.98 RC 2.
  • resolution set to fixed.

fixed in [2080]

Patch is very much appreciated. I changed it just a little, so you may wish to check the change-log? If you see anything else like this, please don't hesitate to make another patch. This kind of thing really does help a lot :)

Thx!