On Wed, Sep 24, 2014 at 11:24:02AM -0700, Jarno Rajahalme wrote: > Before: > > $ tests/ovstest test-bitmap benchmark 1000000 > bitmap equal: 328 ms > bitmap scan: 8159 ms > > After: > > $ tests/ovstest test-bitmap benchmark 1000000 > bitmap equal: 230 ms > bitmap scan: 185 ms > > Signed-off-by: Kmindg <kmi...@gmail.com> > Signed-off-by: Jarno Rajahalme <jrajaha...@nicira.com>
Very nice. In bitmap_equal(), I think that this: i = ROUND_DOWN(n, BITMAP_ULONG_BITS); n -= i; /* Remaining bits. */ can just be written "n %= BITMAP_ULONG_BITS;" Did you consider writing a single bitmap scan function that takes a parameter to XOR with the bitmap words? Then bitmap_scan1() would pass 0 and bitmap_scan0() would pass ULONG_MAX. If this bitmap scan function were marked ALWAYS_INLINE (and the compiler honored it) then it would eliminate some redundant code. In bitmap_scan[01], the inner "if (!unit)" seems to not be needed, because the outer start < end check will also do the right thing. I don't know whether it is better from a performance standpoint to remove the inner check, or whether it is better from an "obviously correct" standpoint to keep it. The comment on bitmap_init1() about its return value is wrong. Acked-by: Ben Pfaff <b...@nicira.com> _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev