[ovs-dev] [PATCH 2/5] lib/cmap: More efficient cmap_find().

Jarno Rajahalme jrajahalme at nicira.com
Mon Oct 6 21:41:30 UTC 2014


On Oct 6, 2014, at 10:47 AM, Ben Pfaff <blp at nicira.com> wrote:

> On Wed, Sep 24, 2014 at 11:31:44AM -0700, Jarno Rajahalme wrote:
>>    These makes cmap_find 10% faster on GCC 4.7 (-O2 -g).
>> 
>> Signed-off-by: Jarno Rajahalme <jrajahalme at nicira.com>
> 
> I'm surprised it makes so much difference!
> 
> What if we additionally change:
>    if (OVS_UNLIKELY(counter_changed(b1, c1))) {
>        goto retry;
>    }
>    if (node) {
>        return node;
>    }
> to this?
>    if (node) {
>        if (OVS_UNLIKELY(counter_changed(b1, c1))) {
>            goto retry;
>        }
>        return node;
>    }
> I can see an argument that it would help, and a different one that it
> would hurt.
> 

Average over 10 runs of each showed no difference in performance.

> Either way:
> Acked-by: Ben Pfaff <blp at nicira.com>

Thanks!




More information about the dev mailing list