A significant performance difference

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Sep 1 03:35:50 PDT 2014


On Mon, 1 Sep 2014 12:38:52 +0300
ketmar via Digitalmars-d-learn <digitalmars-d-learn at puremagic.com>
wrote:

> i found that slowdown is from _aaRange()
and i'm wrong again. adding `_aaFrontKey()` and `_aaFrontValue()` makes
no difference at all.

that's 'cause both hooks need to go thru bucket array to find first
entry. unless we add some ponter to 'first used bucket', getting
'first' key and value will be slow.

so, to make this fast, we need to cache info about 'first used bucket'.

i hacked in VERY simple caching, and... voila: execution time for
'byKey/byValue' variant drops from 3 seconds to 1.5 seconds. seems that
it's as far as i can get without hurting AA performance in other cases.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20140901/60726f14/attachment.sig>


More information about the Digitalmars-d-learn mailing list