match: Single malloc minimatch.
authorJarno Rajahalme <jrajahalme@nicira.com>
Wed, 15 Jul 2015 20:17:01 +0000 (13:17 -0700)
committerJarno Rajahalme <jrajahalme@nicira.com>
Wed, 15 Jul 2015 20:17:10 +0000 (13:17 -0700)
commitceb3bd6731b90c1ec466777f23efab6991800e37
tree9d7dab2bd49a46962b480300316314d89ac37f2c
parent8fd4792403254f868398a89fb5625830ee5a08eb
match: Single malloc minimatch.

Allocate the miniflow and minimask in struct minimatch at once, so
that they are consecutive in memory.  This halves the number of
allocations, and allows smaller minimatches to share the same cache
line.

After this a minimatch has one heap allocation for all it's data.
Previously it had either none (when data was small enough to fit in
struct miniflow's inline buffer), or two (when the inline buffer was
insufficient).  Hopefully always having one performs almost the same
as none or two, in average.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
lib/flow.c
lib/flow.h
lib/match.c
lib/match.h