~skeeto/public-inbox

1

Re: MSI HASH TABLE BENCHMARK

Details
Message ID
<CAAiNwPruyiFqMxWZSs-8cE9UKV-m2ne0se5BUNadfg-=FYKC2w@mail.gmail.com>
DKIM signature
pass
Download raw message
https://godbolt.org/z/54E7Po6Mq

I assume this is the correct version. Although GODBLOT  refuses it,
perhaps it takes too many resources and time.

The plan is to throw into the mix UTHASH (by Troy D. Hanson) based version.

Re: MSI HASH TABLE BENCHMARK

Details
Message ID
<CAAiNwPqU2Vksc8z8u-8gMhSHi_i4aDgfGy1jfSZMWr=KtqDW+g@mail.gmail.com>
In-Reply-To
<CAAiNwPruyiFqMxWZSs-8cE9UKV-m2ne0se5BUNadfg-=FYKC2w@mail.gmail.com> (view parent)
DKIM signature
pass
Download raw message
Works locally with NP and of course shows the C speed.

Basically changed the code to make it UBENCH  malleable; meaning no user loops.

this is the C version

{
    // int len = 0;
    static struct val ht[HT_COUNT + 1] = {};

    memset( ht, 0, sizeof(struct val[HT_COUNT + 1]));

    int i = RANDINRANGE(0, HT_COUNT);

    // for (int i = 0; i < HT_COUNT ; i++) {
        struct val v = make(i);
        uint64_t h = hash(v);
        for (int i = h;;) {
            i = next(h, HT_COUNT + 1, i);
            if (!ht[i].s[0]) {
                ht[i] = v;
                // len++;
                break;
            }
            assert(!equal(ht[i], v));
        }
    // }
    // assert(len == HT_COUNT);
}

And this is the C++ version

{
    // int len = 0;
    static std::set<std::string> ht;
    ht.clear();

     int i = RANDINRANGE(0, HT_COUNT);

    // for (int i = 0; i < HT_COUNT ; i++) {
        auto v = std::to_string(i);
        auto r = ht.insert(v);

        (void)v;
        (void)r;
        // len += r.second;
    // }
    // assert(len == HT_COUNT);
}

Dusan Jovanovic MSc Arch, TOGAF(R)
---------------------------------------------------------------------
Before printing please consider a lot of various things, although
 just the preservation of the environment might be enough.



On Thu, 20 Oct 2022 at 18:13, DBJ <dbjdbj@gmail.com> wrote:
>
> https://godbolt.org/z/54E7Po6Mq
>
> I assume this is the correct version. Although GODBLOT  refuses it,
> perhaps it takes too many resources and time.
>
> The plan is to throw into the mix UTHASH (by Troy D. Hanson) based version.
Reply to thread Export thread (mbox)