[webkit-dev] Performance of NamedAttrMap

Jens Alfke snej at chromium.org
Thu Oct 29 14:30:00 PDT 2009


I was looking at the performance of Element.getAttribute(), and I see  
that NamedAttrMap, which actually stores the attributes, is  
implemented as an unsorted array. This makes looking up an attribute  
an O(n) operation. Is there any reason this couldn't be optimized to  
use a HashMap, or at least binary search?

(I thought the answer might be that the order of attributes is  
significant; but I just checked the DOM spec, and NamedNodeMap is  
explicitly unordered.)

—Jens
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20091029/86a3058d/attachment.html>


More information about the webkit-dev mailing list