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/parser/Lexer.cpp

    r39942 r40501  
    8181    , m_mainTable(JSC::mainTable)
    8282{
    83     m_buffer8.reserveCapacity(initialReadBufferCapacity);
    84     m_buffer16.reserveCapacity(initialReadBufferCapacity);
     83    m_buffer8.reserveInitialCapacity(initialReadBufferCapacity);
     84    m_buffer16.reserveInitialCapacity(initialReadBufferCapacity);
    8585}
    8686
     
    885885
    886886    Vector<char> newBuffer8;
    887     newBuffer8.reserveCapacity(initialReadBufferCapacity);
     887    newBuffer8.reserveInitialCapacity(initialReadBufferCapacity);
    888888    m_buffer8.swap(newBuffer8);
    889889
    890890    Vector<UChar> newBuffer16;
    891     newBuffer16.reserveCapacity(initialReadBufferCapacity);
     891    newBuffer16.reserveInitialCapacity(initialReadBufferCapacity);
    892892    m_buffer16.swap(newBuffer16);
    893893
Note: See TracChangeset for help on using the changeset viewer.