rt/aaA.d Line: 553

Ferhat Kurtulmuş aferust at gmail.com
Sat Feb 15 11:49:05 UTC 2020


On Friday, 14 February 2020 at 23:41:45 UTC, Steven Schveighoffer 
wrote:
> On 2/14/20 6:36 PM, Ferhat Kurtulmuş wrote:
>>      İf ((aa.used + 1)* GROW_DEN > aa.dim * GROW_NUM)
>>          aa.grow(ti.key);
>
> This call is expensive (it reallocates all the buckets and 
> reinserts all the existing data into the new bucket), it should 
> be avoided if in the end we will not be incrementing used.
>
> -Steve

I am trying to write a gc-free AA based on the original runtime 
code (mem with malloc and free). My question is that why my 
version is slower (about 1.5 times slower) than the runtime 
version?

https://controlc.com/2e58c305

Those are some differences from runtime version:

- nogc and no typeid of course.
- does not care about postblit of key types (don't need it, 
assume only basic types are allowed for key type)
- runtime version uses typeid to do some alignments which are not 
implemented in my version. Is that the reason why my code is 
slower?




More information about the Digitalmars-d-learn mailing list