Skip to content
  • andreas.kling@nokia.com's avatar
    Viewing a post on reddit.com wastes a lot of memory on event listeners. · 2574e777
    andreas.kling@nokia.com authored
    https://bugs.webkit.org/show_bug.cgi?id=67133
    
    Reviewed by Darin Adler.
    
    Source/JavaScriptCore: 
    
    Add a minimum table size to the HashTraits, instead of having it hard coded.
    The default value remains at 64, but can now be specialized.
    
    * runtime/StructureTransitionTable.h:
    * wtf/HashTable.h:
    (WTF::HashTable::shouldShrink):
    (WTF::::expand):
    (WTF::::checkTableConsistencyExceptSize):
    * wtf/HashTraits.h:
    
    Source/WebCore: 
    
    Specialize the HashMap used to store registered listeners on an EventTarget
    to have a minimum size of 32 (rather than the default 64.)
    It's very rare for pages to register listeners for so many different events
    and this cuts memory consumption in half for the common case.
    
    As an example, for a typical post on the reddit.com front page,
    this reduces memory used by ~700kB on 64-bit.
    
    * dom/EventTarget.h:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@93990 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    2574e777