• bratell@opera.com's avatar
    Make ObserverList non-inline to save 90KB with gcc · 86262b2a
    bratell@opera.com authored
    With gcc, ObserverList expands to 6-700 bytes every time it is 
    iterated. By not trying to force OberservListBase to be inline
    that shrinks some. clang already ignores the hints to inline 
    the code and actually doesn't change a single bit in the generated
    program with this change.
    
    raw data:
    Total change: -90875 bytes
    ==========================
      262 added, totalling +39188 bytes across 2 sources
      49 removed, totalling -27573 bytes across 16 sources
      23 grown, for a net change of +3600 bytes (34968 bytes before, 38568 bytes after) across 8 sources
      228 shrunk, for a net change of -106090 bytes (239819 bytes before, 133729 bytes after) across 53 sources
    
    The additions is about 2-300 different flavours of ObserverListBase, 100-300 bytes each.
    
    The savings are 200-600 bytes each every time an observer list is used. For example:
    
    -870: content::RenderFrameImpl::didFailLoad(blink::WebLocalFrame*, blink::WebURLError const&) type=t, (was 1635 bytes, 
    now 765 bytes)
    -895: content::RenderFrameImpl::didFinishLoad(blink::WebLocalFrame*) type=t, (was 1646 bytes, now 751 bytes)
    -583: content::WebContentsImpl::DidFailProvisionalLoadWithError(content::RenderFrameHostImpl*, FrameHostMsg_DidFailProvisionalLoadWithError_Params const&) type=t, (was 768 bytes, now 185 bytes)
    -611: content::WebContentsImpl::DidStartProvisionalLoad(content::RenderFrameHostImpl*, GURL const&, bool, bool) type=t, (was 895 bytes, now 284 bytes)
    
    BUG=394311
    
    Review URL: https://codereview.chromium.org/396473004
    
    git-svn-id: svn://svn.chromium.org/chrome/trunk/src@283762 0039d316-1c4b-4281-b951-d872f2087c98
    86262b2a
observer_list.h 6.89 KB