udoprog/c10t — Issue #230: More effiicient cache system
Author: Sworddragon
Created: 2012-01-08 04:42:24+00:00
State: open

I have made a few tests with the cache system:

>START=$(date +%s) && c10t -w /srv/minecraft/world -o world.png -R 100 && END=$(date +%s) && echo $(($END-$START))

Without the cache 30 seconds were needed.

>START=$(date +%s) && c10t -w /srv/minecraft/world -o world.png -R 100 --cache-key='key' && END=$(date +%s) && echo $(($END-$START))

There was no cache so the first run needed 92 seconds.

>START=$(date +%s) && c10t -w /srv/minecraft/world -o world.png -R 100 --cache-key='key' && END=$(date +%s) && echo $(($END-$START))

With the cache (cache_hits: 24074/24074) only 25 seconds were needed.

The cache can be only used on the same options because of the current behaviour of --cache-key. A user need to look at the worldmap 14 times with the same options until he gains benefits from the cache. There are 3 things that could be enhanced:

1. Reading from the cache seems to be very slow. In my case the cache directory contains 24074 files and 4162 directories. Maybe accessing and checking these files is the problem here. A solution could be to find a way to use less files (for example a simple database).

2. Writing the cache files needs a lot of time too. Maybe one big cache file could solve this problem too.

3. --cache-dir needs for every option an own unique key. But theoretically options like -R doesn't need this. There could be an option which is generating automatically a cache key using only the options that are really needed.