War of allocators: TLSF in action
The main focus of my next experiment is yet another allocator called TLSF (Two-Level Segregate Fit). Based on the info published on its website, TLSF has bounded response time, efficient allocation methods which are fast enough, and it has efficient memory usage. Furthermore, the site promises quite good memory fragmentation values. Can it demonstrate all this inside WebKit?
This blog is an extended version of my "War of allocators: hoard or hoards?" post, so the non-TLSF results might be familiar from my formerly post. My benchmark machine is an x86 Debian-Lenny with an SMP kernel and a dual-core 2.33GHz CPU. Naturally, I used the Linux-Qt port of WebKit and I chose its official r55720 revision. The memory results are represent the maximum resident set size (RSS) of the memory consumption and they are provided by our modified Linux kernel.
I think Methanol is the most "close to real life" benchmark and unfortunately, the used implementation of TLSF doesn't show good values. TLSF is 33% slower than TCmalloc... I hoped this was only a measurement bobble, but this value is an average based on measurements executed ten times with low (<5%) standard deviation. Furthermore, to provide this lame performance result it consumes 20% more memory than TCmalloc.
SunSpider in QtLauncher
V8 in QtLauncher
TCmalloc is faster than TSLF by 5.6%, although it consumes 1.6% more memory. I think these are not too bad values.
WindScorpion in QtLauncher
Huh, I don't know why TLSF performs as bad on these long running test, but it is 25% slower than TCmalloc, and it consumes 24% more memory. This is unacceptable...
Two SunSpider workers in QtLauncher
As the chart shows, TCmalloc is the fastest allocator on this multi-threaded benchmark. It is 31% faster than TLSF, but the good result has a price: on the side of memory consumption, it consumes 10.8% more memory than TLSF.
Two V8 workers in QtLauncher
We can run V8 test simultaneously as well. Let's do it!
TCmalloc performs as good as in the case of SunSpider. It is 28% faster than TLSF, but it consumes 3.2% more memory.
In the most of the cases, TCmalloc provides better values than TLSF. Interestingly, on the tests which contain micro benchmarks, TLSF overtakes TCmalloc on memory consumption side, but unfortunately, on long running and real life tests it does not. We can not say that it is bad for WebKit, but it doesn't convince me fairly.