Alberto Garcia 812e4082ca qcow2: use a hash to look for entries in the L2 cache
The current cache algorithm traverses the array starting always from
the beginning, so the average number of comparisons needed to perform
a lookup is proportional to the size of the array.

By using a hash of the offset as the starting point, lookups are
faster and independent from the array size.

The hash is computed using the cluster number of the table, multiplied
by 4 to make it perform better when there are collisions.

In my tests, using a cache with 2048 entries, this reduces the average
number of comparisons per lookup from 430 to 2.5.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2015-05-22 17:08:01 +02:00
..
2015-04-28 15:36:09 +02:00
2015-02-06 17:24:21 +01:00
2014-12-10 10:31:19 +01:00
2015-04-28 15:36:09 +02:00
2015-05-11 08:59:07 -04:00
2015-02-16 15:07:19 +00:00
2015-04-28 15:36:08 +02:00
2014-08-15 15:07:14 +02:00