summaryrefslogtreecommitdiff
path: root/image/image.c
diff options
context:
space:
mode:
authorVincent Sanders <vince@netsurf-browser.org>2011-09-06 22:01:47 +0000
committerVincent Sanders <vince@netsurf-browser.org>2011-09-06 22:01:47 +0000
commite471efa0967586c7a7ab1060572ebcec0b02269f (patch)
tree7b58538cd547b21e4d143560fde252132ea7ff6e /image/image.c
parent95dfffb3dfcb060682c9e47f557a534369d23904 (diff)
downloadnetsurf-e471efa0967586c7a7ab1060572ebcec0b02269f.tar.gz
netsurf-e471efa0967586c7a7ab1060572ebcec0b02269f.tar.bz2
make the image_cache cleaner less brain dead
svn path=/trunk/netsurf/; revision=12766
Diffstat (limited to 'image/image.c')
-rw-r--r--image/image.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/image/image.c b/image/image.c
index fb8197b28..d65ae8a67 100644
--- a/image/image.c
+++ b/image/image.c
@@ -38,6 +38,22 @@
#include "utils/config.h"
+/** low water mark for speculative pre-conversion */
+
+/* Experimenting by visiting every page from default page in order and
+ * then netsurf homepage
+ *
+ * 0 : Cache hit/miss/speculative miss/fail 604/147/ 0/0 (80%/19%/ 0%/ 0%)
+ * 2048 : Cache hit/miss/speculative miss/fail 622/119/ 17/0 (82%/15%/ 2%/ 0%)
+ * 4096 : Cache hit/miss/speculative miss/fail 656/109/ 25/0 (83%/13%/ 3%/ 0%)
+ * 8192 : Cache hit/miss/speculative miss/fail 648/104/ 40/0 (81%/13%/ 5%/ 0%)
+ * ALL : Cache hit/miss/speculative miss/fail 775/ 0/161/0 (82%/ 0%/17%/ 0%)
+*/
+#define SPECULATE_SMALL 4096
+
+/* the time between cache clean runs in ms */
+#define CACHE_CLEAN_TIME (10 * 1000)
+
/**
* Initialise image content handlers
*
@@ -46,8 +62,14 @@
nserror image_init(void)
{
nserror error;
-
- error = image_cache_init();
+ struct image_cache_parameters image_cache_parameters = {
+ .bg_clean_time = CACHE_CLEAN_TIME,
+ .limit = (8 * 1024 * 1024),
+ .hysteresis = (2 * 1024 * 1024),
+ .speculative_small = SPECULATE_SMALL
+ };
+
+ error = image_cache_init(&image_cache_parameters);
if (error != NSERROR_OK)
return error;