[webkit-dev] WAS: JS binding wapper pointers: inline vs. separate hash table
Feng Qian
feng at chromium.org
Wed Oct 1 14:35:59 PDT 2008
Sorry to hijack the original thread because I didn't subscribe the
mailing list using this email account.
I did some performance measurement a few weeks ago. I made a version
of Chrome without Peerable (except SVG), it allows me to run many
tests.
I wrote a macro benchmark to exercise DOM -> JS wrapping code as much
as possible:
// collect all nodes in the page
for (var j = 0; j < num_nodes; j++) {
var a = nodes[j];
for (var i = 0; i < 10; i++) {
a.parentNode; a.childNodes; a.firstChild; a.lastChild;
a.previousSibling; a.nextSibling; a.attributes; a.ownerDocument;
a.parentElement;
}
}
These Node properties all return a DOM node, and it loops several
times to minimize the overhead of other JS constructs.
I reused Dromaeo framework to run the test. The test page has ~4600
nodes. Using Dromaeo framework to run the test along, I observed that
with Peerable cache, it is about 7~8% faster. When the test with other
Dromaeo tests, I observed that Peerable was 25% faster, but other
tests either faster or slower, so I cannot tell if that's because of
real impact of caching or some other effects. One thing for sure is
that when running whole Dromaeo tests, the memory usage went to to
430+MB. That's may have an effect.
I think the performance difference can even be measured outside of
browser, it really measures how much performance improvement of a
cache on top of a hashmap vs. the memory overhead and maintenance
costs.
Mads Ager has more data on memory overhead.
Cheers,
Feng
More information about the webkit-dev
mailing list