[webkit-reviews] review granted: [Bug 88240] Make ElementAttributeData a variable-sized object to reduce memory use. : [Attachment 151711] EWSxperiment 3

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Jul 12 04:02:47 PDT 2012


Antti Koivisto <koivisto at iki.fi> has granted Andreas Kling <kling at webkit.org>'s
request for review:
Bug 88240: Make ElementAttributeData a variable-sized object to reduce memory
use.
https://bugs.webkit.org/show_bug.cgi?id=88240

Attachment 151711: EWSxperiment 3
https://bugs.webkit.org/attachment.cgi?id=151711&action=review

------- Additional Comments from Antti Koivisto <koivisto at iki.fi>
View in context: https://bugs.webkit.org/attachment.cgi?id=151711&action=review


r=me, glorious

> Source/WebCore/dom/Element.cpp:244
> +    // FIXME: This shouldn't have to make the ElementAttributeData mutable.
> +    const_cast<Element*>(this)->ensureUpdatedAttributeData();

Is there is really anything wrong with this? The FIXME might be an overkill
(and point to over-optimization). Un-consting the function would remove that
awkward const_cast.

> Source/WebCore/dom/ElementAttributeData.cpp:69
> +    , m_mutableAttributeVector(new Vector<Attribute, 4>)
> +{
> +    // This copy constructor should only be used by makeMutable() to go from
immutable to mutable.
> +    ASSERT(!other.m_isMutable);
> +    for (unsigned i = 0; i < other.m_arraySize; ++i)
> +	   m_mutableAttributeVector->append(other.array()[i]);
> +}

This could use reserverInitialCapacity() and uncheckedAppend().

Not sure how to calculate the optimal initial capacity. Maybe just 1 more than
the current size?


More information about the webkit-reviews mailing list