Array append performance

bearophile bearophileHUGS at lycos.com
Sat Aug 23 15:42:49 PDT 2008


Steven Schveighoffer:
> Making all arrays (even ones that you create temporarily and never append 
> to) have extra data to copy will add up performance-wise.

Benchmarks of new features help estimate such performance tradoffs in real programs.


> I think there are 
> only a few spots in any of my code that I use the append operator.  So 
> 'important' it is, but common, I would argue it is not.  Of course, I only 
> present anectodal evidence :)

In the Python world they solve this problem taking a look at real code. So some projects in the dsource repository can be mined to estimate how much often the appending is used in real programs.
Note that a std lib library is meant to be very efficient, because people use it as a source of building blocks to write normal programs, so I presume Tango/Phobos will have less array appends than the average user-level code, so they may be excluded from such database.


> There's also the advantage of backwards compatibility, and not having to 
> change the D spec.

It's probably meant as a change for D 2 only.

Bye,
bearophile



More information about the Digitalmars-d mailing list