On Mon, Jun 15, 2009 at 16:12, Aryeh Gregor <[email protected]<simetrical%[email protected]> > wrote:
> On Mon, Jun 15, 2009 at 7:11 PM, Kristof > Zelechovski<[email protected]> wrote: > > The complexity of using a set/map is logarithmic in the size of the set. > > Not if it's implemented as a hash table. > > Is DOMTokenList really expected to store lists large enough that this > asymptotic behavior matters, though? > For WebKit I was initially not planning to use a backing map/set. Class lists should be pretty small and for small lists it is faster to iterate over the list than using a hash table. If this ends up being a performance issue a backing map/set can be used. (WebKit uses a vector internally and does O(n) lookups when computing the style so I doubt it will be a performance issue.) -- erik
