[webkit-dev] DOM tree traversal on detached nodes
ggaren at apple.com
Mon Jun 11 21:23:27 PDT 2012
> Actually I've tried the approach yesterday but confirmed 25.9%
> performance regression, even if I have TreeShared hold a pointer to
> the root. Please look at the WIP patch and the performance test in
> What I've learned is that we must not insert any line to ref() and
> deref(), which are performance sensitive:)
I don't take away the same lesson.
The WIP patch you posted has these performance issues:
- adds 2 data members to every node, increasing malloc cost and memory traffic
- adds a call to fprintf inside ref() and deref(), probably making them ineligible for inlining
- does a test against "!m_parent" in rootDeref, which can be removed
Also, does your benchmark, with this patch attached, ever tear down a DOM tree? You haven't changed any of the other document tear-down machinery to match, so you're still paying the cost of lots of irrelevant tear-down code, and/or possibly leaking lots of memory.
To test your "ref is sacred" theory on this benchmark, just insert this one line of code into ref():
This is a memory leak, but it will make it through your benchmark without crashing, and give you a ballpark performance test of the design I described.
More information about the webkit-dev