Ignore:
Timestamp:
Feb 2, 2009, 4:27:14 PM (16 years ago)
Author:
Darin Adler
Message:

JavaScriptCore:

2009-02-02 Darin Adler <Darin Adler>

Reviewed by Dave Hyatt.

Bug 23676: Speed up uses of reserveCapacity on new vectors by adding a new reserveInitialCapacity
https://bugs.webkit.org/show_bug.cgi?id=23676

  • API/JSObjectRef.cpp: (JSObjectCopyPropertyNames): Use reserveInitialCapacity.
  • parser/Lexer.cpp: (JSC::Lexer::Lexer): Ditto. (JSC::Lexer::clear): Ditto.
  • wtf/Vector.h: Added reserveInitialCapacity, a more efficient version of reserveCapacity for use when the vector is brand new (still size 0 with no capacity other than the inline capacity).

WebCore:

2009-02-02 Darin Adler <Darin Adler>

Reviewed by Dave Hyatt.

Bug 23676: Speed up uses of reserveCapacity on new vectors by adding a new reserveInitialCapacity
https://bugs.webkit.org/show_bug.cgi?id=23676

  • bindings/js/JSCSSStyleDeclarationCustom.cpp: (WebCore::cssPropertyName):
  • css/CSSMutableStyleDeclaration.cpp: (WebCore::CSSMutableStyleDeclaration::CSSMutableStyleDeclaration): (WebCore::CSSMutableStyleDeclaration::removePropertiesInSet):
  • css/CSSPrimitiveValue.cpp: (WebCore::CSSPrimitiveValue::cssText):
  • css/CSSStyleDeclaration.cpp: (WebCore::CSSStyleDeclaration::copyPropertiesInSet):
  • css/CSSStyleSelector.cpp: (WebCore::CSSStyleSelector::sortMatchedRules):
  • dom/Document.cpp: (WebCore::Document::formElementsState):
  • dom/NamedAttrMap.h: (WebCore::NamedAttrMap::reserveInitialCapacity):
  • editing/TextIterator.cpp: (WebCore::CharacterIterator::string): (WebCore::SearchBuffer::SearchBuffer): (WebCore::plainTextToMallocAllocatedBuffer):
  • editing/markup.cpp: (WebCore::joinMarkups):
  • history/HistoryItem.cpp: (WebCore::HistoryItem::HistoryItem):
  • html/HTMLTokenizer.cpp: (WebCore::Token::addAttribute):
  • loader/appcache/DOMApplicationCache.cpp: (WebCore::DOMApplicationCache::items):
  • page/SecurityOrigin.cpp: (WebCore::SecurityOrigin::toString):
  • page/mac/AccessibilityObjectWrapper.mm: (convertToVector):
  • platform/graphics/FontCache.cpp: (WebCore::FontCache::purgeInactiveFontData): (WebCore::FontCache::invalidate):
  • platform/network/FormData.cpp: (WebCore::FormData::deepCopy):
  • platform/network/HTTPHeaderMap.cpp: (WebCore::HTTPHeaderMap::copyData):
  • platform/network/ResourceRequestBase.cpp: (WebCore::ResourceRequestBase::copyData):
  • platform/network/mac/FormDataStreamMac.mm: (WebCore::formCreate):
  • xml/XPathNodeSet.cpp: (WebCore::XPath::NodeSet::sort): Use reserveInitialCapacity instead of of reserveCapacity in all these call sites, which are working on new vectors that are guaranteed not to be empty.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/API/JSObjectRef.cpp

    r40046 r40501  
    468468
    469469    size_t size = array.size();
    470     propertyNames->array.reserveCapacity(size);
     470    propertyNames->array.reserveInitialCapacity(size);
    471471    for (size_t i = 0; i < size; ++i)
    472472        propertyNames->array.append(JSRetainPtr<JSStringRef>(Adopt, OpaqueJSString::create(array[i].ustring()).releaseRef()));
Note: See TracChangeset for help on using the changeset viewer.