Fastest Way to Append Multiple Elements to an Array

Anonymous via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Dec 19 09:15:19 PST 2014


On Friday, 19 December 2014 at 15:25:46 UTC, Steven Schveighoffer 
wrote:
> On 12/18/14 5:27 PM, zeljkog wrote:
>> On 18.12.14 14:50, Steven Schveighoffer wrote:
>>> I wonder how your code compares to this:
>>>
>>> void append(T)(ref T[] arr, T[] args...)
>>> {
>>>     arr ~= args;
>>> }
>>
>> This is ~20% slower for ints, but it difference  increases for 
>> bigger structs.
>>
>
> This is surprising to me.
>
> -Steve

Ho ho ho, this year he has brought your surprise sooner than 
expected...



More information about the Digitalmars-d-learn mailing list