[dev] [surf] [patch] Multiple views, one process

From: Carlos Pita <carlosjosepita_AT_gmail.com>
Date: Fri, 19 Oct 2012 13:20:49 -0300

Hi all,

I've coded this patch that considerably reduces surf memory usage (and
some LOCs) by avoiding the creation of a new process each time a new
webview is created. The patch is very simple, it just replaces calls
to newwindow with calls to a slightly modified newclient. This only
applies to "inside" events: from the context menu, clicking urls, etc.
You still can exec surf to get a new process running.

All this play well with tabbed. In fact, it was the memory consumption
of N opened tabs (say N*M) that motivates me to write the patch (so
N*M is now reduced to something about M, or avg(M) or max(M)... anyway
an improvement).

For example, you go from something like this (4 instances at www.google.com):

 PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
 3559 carlos 20 0 196m 61m 24m S 0.3 3.0 0:01.37
surf
 3558 carlos 20 0 196m 57m 24m S 0.0 2.9 0:01.40
surf
 3560 carlos 20 0 196m 58m 25m S 0.0 2.9 0:01.40
surf
 3561 carlos 20 0 196m 58m 25m S 0.0 2.9 0:01.39 surf

to this:

3558 carlos 20 0 238m 79m 27m S 0.3 3.9 0:03.47 surf

Of course the improvement will depend on you usage pattern. If you
tend to open a number of webviews at the same time the gain will be
important.

I've not tested it thoroughly so use with care if you use it at all.

Best regards
--
Carlos

Received on Fri Oct 19 2012 - 18:20:49 CEST

This archive was generated by hypermail 2.3.0 : Fri Oct 19 2012 - 18:24:04 CEST