It seems there is a bug because: - 20 bytes are compared, but only 1 byte stored_keys step is used - entries can overlap each other by 19 bytes - index_mmap is ~1.3M in size, but only first 64K is used
With this fix for Deus Ex: - startup time (from launch to Feral logo): ~38s -> ~16s - disk_cache_has_key() hit rate: ~50% -> ~96% Signed-off-by: Grazvydas Ignotas <[email protected]> --- src/util/disk_cache.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c index 7d10ba2..b88ef52 100644 --- a/src/util/disk_cache.c +++ b/src/util/disk_cache.c @@ -1025,11 +1025,11 @@ disk_cache_put_key(struct disk_cache *cache, const cache_key key) { const uint32_t *key_chunk = (const uint32_t *) key; int i = *key_chunk & CACHE_INDEX_KEY_MASK; unsigned char *entry; - entry = &cache->stored_keys[i + CACHE_KEY_SIZE]; + entry = &cache->stored_keys[i * CACHE_KEY_SIZE]; memcpy(entry, key, CACHE_KEY_SIZE); } /* This function lets us test whether a given key was previously @@ -1044,11 +1044,11 @@ disk_cache_has_key(struct disk_cache *cache, const cache_key key) { const uint32_t *key_chunk = (const uint32_t *) key; int i = *key_chunk & CACHE_INDEX_KEY_MASK; unsigned char *entry; - entry = &cache->stored_keys[i + CACHE_KEY_SIZE]; + entry = &cache->stored_keys[i * CACHE_KEY_SIZE]; return memcmp(entry, key, CACHE_KEY_SIZE) == 0; } void -- 2.7.4 _______________________________________________ mesa-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-dev
