[Issue 13410] Performance problem with associative array byKey/byValue

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Oct 1 01:46:38 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=13410

--- Comment #24 from Martin Nowak <code at dawg.eu> ---
In other words, this optimizes the following code

    foreach (_; 0 .. 1_000_000)
        aa.byKey();

but pessimizes the following

    aa.remove(key);

It does NOT improve iterating byKey.
So unless there is a valid use case to call aa.byKey.front in a loop this would
only improve a pointless microbenchmark.
Batch deletion is much better done with a dedicated remove function.

    aa.remove((k, v) => pred(k));

Any volunteers for implementing the latter?

--


More information about the Digitalmars-d-bugs mailing list