[webkit-dev] Optimization of buffer allocation of Vector and StringBuilder

Darin Adler darin at apple.com
Mon Oct 10 12:14:27 PDT 2011


On Oct 10, 2011, at 4:46 AM, Xianzhu Wang (王显著) wrote:

> malloc_good_size() can get the rounded-up size of a required size, but it seems not available on all platforms. It's easy to implementation it over tcmalloc. On platforms that malloc_good_size() is not available, it's possible to get the mapping with a program and then hardcode the rules in WebKit, but I'm afraid if the rules could match the actual running environment. Any ideas?

I think the key is to actually predict and measure the benefits of the change, ideally with real use cases.

At one point I experimented with using this for string buffers expecting it to make code use less memory and be faster but when I did it I could not measure the benefit I expected.

I think we can start by just not doing the tuning at all on platforms without a malloc_good_size and then dig deeper if we have a specific example of a problematic platform.

    -- Darin



More information about the webkit-dev mailing list