200-600x slower Dlang performance with nested foreach loop
Paul Backus
snarwin at gmail.com
Wed Jan 27 15:12:32 UTC 2021
On Wednesday, 27 January 2021 at 14:15:26 UTC, FeepingCreature
wrote:
>
> Associative arrays allocate per entry added?!
>
> https://github.com/dlang/druntime/blob/master/src/rt/aaA.d#L205
> Oh God, associative arrays allocate per entry added!
Maybe it's to avoid invalidating the result of `key in aa` when
adding or removing entries? The spec doesn't say anything about
it either way [1], but allowing invalidation would make AAs much
more difficult to use in @safe code.
[1] https://dlang.org/spec/hash-map.html
More information about the Digitalmars-d-learn
mailing list