[Issue 13748] benchmark druntime/benchmark/aabench/string.d fails

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Nov 18 17:14:46 PST 2014


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

--- Comment #1 from Steven Schveighoffer <schveiguy at yahoo.com> ---
Found the issue.

The following code tests the problem (adding as a unit test), but is highly
dependent on the AA implementation:

void main()
{
    int[int] aa;
    // make all values go into the last bucket (int hash is simply the int)
    foreach(i; 0..16)
    {
        aa[3 + i * 4] = 1;
        assert(aa.keys.length == i+1);
    }

    // now force a rehash, but with a different hash value (lower than current
    // first used bucket)
    aa[0] = 1;
    assert(aa.keys.length == 17);
}

PR: https://github.com/D-Programming-Language/druntime/pull/1025

--


More information about the Digitalmars-d-bugs mailing list