diff options
author | Rob Kendrick <rjek@netsurf-browser.org> | 2008-07-07 14:05:29 +0000 |
---|---|---|
committer | Rob Kendrick <rjek@netsurf-browser.org> | 2008-07-07 14:05:29 +0000 |
commit | e7c5e16b9b4f75da948f6d27e8de19d7a149548e (patch) | |
tree | a70c6cdc790e2dc881f0f5c09f88ff9eab3a9206 /content/content.c | |
parent | 192faa217735d0ab06aeed02a01558f5c95aef72 (diff) | |
download | netsurf-e7c5e16b9b4f75da948f6d27e8de19d7a149548e.tar.gz netsurf-e7c5e16b9b4f75da948f6d27e8de19d7a149548e.tar.bz2 |
Performance improvements: rather than calling content_clean() every poll, we now call it no more frequently than once every 5 seconds. Additionally, we cache the result of talloc_total_size() in content_clean() rather than calculating it twice. On large documents, this function took 25% of CPU time. This makes the fetching/rendering/scrolling/redrawing of large documents over twice as fast.
svn path=/trunk/netsurf/; revision=4527
Diffstat (limited to 'content/content.c')
-rw-r--r-- | content/content.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/content/content.c b/content/content.c index e4431453a..63b7f7b26 100644 --- a/content/content.c +++ b/content/content.c @@ -873,14 +873,15 @@ void content_clean(void) next = 0; for (c = content_list; c; c = c->next) { next = c; - size += c->size + talloc_total_size(c); + c->talloc_size = talloc_total_size(c); + size += c->size + c->talloc_size; } for (c = next; c && (unsigned int) option_memory_cache_size < size; c = prev) { prev = c->prev; if (c->user_list->next) continue; - size -= c->size + talloc_total_size(c); + size -= c->size + c->talloc_size; content_destroy(c); } } |