Memory consumption: scratching the surface
On Linux platform, WebKit doesn't provide us with tools/scripts for investigating memory consumption, although this topic might be almost as important as runtime performance. For example, just think of an embedded environment where memory is limited and the usage of memory has an impact on the device's power consumption.
Fortunately, Linux's 2.6.16 kernel adds support for smaps, thus we are able to retrive useful information about processes' and libraries' RSS (resident set size). In our investigations we used the following hardware and software setup:
We classified the mapped memory areas into 5 categories:
QtLauncher with no content
Frist, let's see how QtLauncher fits in the memory right after the start, without loading a page.
So, now we have some idea of a single QtLauncher's memory map. Let's continue our investigation with some interesting measurements.
On the next diagram, again I compared QtLauncher's memory consumption after the start, without content load. However, I varied the number of executed processes and opened tabs. The first coloumn in the chart below demonstrates the setup used for the previous diagram (1 process 1 window), the second and third coloumns demonstrate the memory consumption of QtLaunchers that I started in one process with two tabs (1 process 2 tabs) and in two separate processes (2 processes 2 windows).
QtLauncher with Benchmarks
1 process running
Now, let's see the memory consumption of runtime benchmarks (SunSpider, V8, WindScorpion). As you can see our WindScorpion benchmark has the longest runtime and also has the highest memory consumption. SunSpider takes half the time to finish, with less memory consumption and V8 runs quarter of the time and its memory consumption is similar to SunSpider's. (The horizontal axis represents the elapsed time in seconds and the vertical axis represents the memory consumption in kilobytes.)
2 processes versus 1 process running
Now let's see the comparison of simultaneously runnig benchmarks in 2 processes (with 1 window each) and in 1 process with 2 tabs. As you can see for SunSpider, the running time is similar for both cases, but the memory consumption is higher with the two processes setup (as we would expect):
Interestingly, the maximum memory consumption of the V8 benchmark is similar for the 2 processes 1-1 window and for the 1 processes 2 tabs setup.
The WindScorpion benchmark breaks the trend in this case, because it runs much faster with two processes, than with one process. The maximum memory consumption is almost the same.
3 processes versus 1 process running
In the last test, let's see what happens when the three WebKit benchmarks run simultaneously in 3 processes (3 windows) and in 1 process (3 tabs):
In this case, both the running time and the memory consumption is different for the 3 processes 3 windows and the 1 process 3 tabs setup.
We got a bit of insight into the memory consumption of QtLauncher under load, during stress tests. However, the findings bring up additional questions that would be worthy of examination in the future.