From e7c5e16b9b4f75da948f6d27e8de19d7a149548e Mon Sep 17 00:00:00 2001 From: Rob Kendrick Date: Mon, 7 Jul 2008 14:05:29 +0000 Subject: 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 --- desktop/netsurf.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'desktop/netsurf.c') diff --git a/desktop/netsurf.c b/desktop/netsurf.c index cc823d4e9..822f81a77 100644 --- a/desktop/netsurf.c +++ b/desktop/netsurf.c @@ -121,7 +121,16 @@ void netsurf_init(int argc, char** argv) void netsurf_poll(void) { - content_clean(); + static unsigned int last_clean = 0; + unsigned int current_time = wallclock(); + + /* avoid calling content_clean() more often than once every 5 + * seconds. + */ + if (last_clean + 500 < current_time) { + last_clean = current_time; + content_clean(); + } gui_poll(fetch_active); fetch_poll(); } -- cgit v1.2.3