[webkit-dev] strategy for evaluating performance issues related to memory.

Leo Meyerovich lmeyerov at eecs.berkeley.edu
Tue Jun 22 17:51:22 PDT 2010


I've been doing some memory benchmarking recently (my current interest is layout but am also poking at nearby processes). Generally,  data representation seems hard to usefully tweak in a non-invasive way as it's pretty good while being legible (e.g., bit packing), but access patterns (and random allocations) already seem questionable. This especially hurts netbooks/mobiles, but I'm seeing high missrates on my penryn MacBook Pro and it likely surfaces in the new macbook pros with their big L3 but much smaller L2 (though I can't get perf counters w/ Shark to work there).

A high-impact and less-painful first step might be to target CSS selectors & default render style creation:

  -- buffer calls at the end of the parseToken()->insertNode()->attach()->createRender()->styleForRenderer()->styleForElement() pipeline
  -- once enough are in (or there is nothing else to do), perform matchRules/matchUARules calls:
  --      in tiles
  -- ... and in parallel
  -- ... and with software prefetching
  -- resume rest of createRender calls (similar tricks may apply, still not sure)

A different form of this is now in the firefox mainline but there's room to do more using the above (and I suspect with a bit less implementation complexity). 

Anyways, this seems inappropriate for this list, but if anybody would be interested in continuing the discussion, you have my email. Also, if there are any resources describing memory layout / instantiation / etc. patterns and how/why recomputation/memoization are traded off, it would be a nice bootstrap: I've been essentially walking through http://webkit.org/blog/114/webcore-rendering-i-the-basics/,  seeing how the code deviates or specializes, and profiling it with Shark & Instruments.

Regards,

- Leo




On Jun 21, 2010, at 9:05 PM, Maciej Stachowiak wrote:

> 
> On Jun 21, 2010, at 11:59 AM, Mike Marchywka wrote:
> 
>> 
>> I was hardly worried about who does anything as much as what would make sense to do. I have interest, motivation,
>> and multiple copies of the code but not a lot of time to waste of bad approaches. There was a prior discussion
>> about coding conventions that should be applicable even to those contemplating a contribution of just browsing
>> the code, I fail to see how this discussion is less relevant to current and possible future development concerns.
>> 
>> If there was some piece of this or a related effort that could be aided by certain code features that
>> would seem to be of interest to everyone and it isn't clear which people would have important thoughts
>> to contribute ( or I would take it some other place). 
>> 
>> So I take it that now you just have factories and smart pointers and just make stuff and have it
>> allocated wherever without further thought?  I guess I could do some profiling my self and empirically
>> find problems and just assume that no one has specific comments on suspects or things they have observed
>> as possible problems. 
> 
> In my experience with performance work, and specifically in the context of WebKit, I believe the following are useful approaches to reducing memory use:
> 
> 1) Find and fix memory leaks. There are good tools for this, and memory leaks contribute considerably to memory growth over a long browsing session. Long-term memory growth is a bigger concern than one-time costs or per-page memory that is properly returned to the system.
> 
> 2) Run memory profiling tools under a significant and realistic workload, such as Mozilla's "membuster" test. We have had great success with this and in particular you can find some good recent memory use improvements from Sam Weinig and Anders Carlsson, among others, if you look at the ChangeLog.
> 
> 3) Track memory benchmarks regularly, and identify and fix regressions.
> 
> 4) Run long automated page loads to verify that memory growth stabilizes eventually, rather than continuing to grow without bound.
> 
> 5) Investigate memory held by caches, and figure out ways to get the same speed benefits with less overall memory use, for example by discarding redundant data or better tuning the cache to hold the items most likely to be reused.
> 
> 6) Find reproducible cases of non-leak repeatable memory growth, and determine where the extra memory is going.
> 
> 
> If you are interested in improving WebKit's memory use, I encourage you to consider one or more of the above approaches.
> 
> Regards,
> Maciej
> 
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20100622/1cd412a3/attachment.html>


More information about the webkit-dev mailing list