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

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


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

Martin Nowak <code at dawg.eu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |code at dawg.eu

--- Comment #23 from Martin Nowak <code at dawg.eu> ---
I don't really agree with this patch.
HashTables are unordered and optimized for random indexing by a key.
If you run a tight loop and constantly query front (abusing byKey) then of
course that's expensive O(N^2/2). It's like taking a singly linked list and
removing the last element until it's empty.
Instead we should offer a nice and generic remove function that takes a
predicate and allows to batch remove entries.

--


More information about the Digitalmars-d-bugs mailing list