Subject: Re: SymCache optimization (was Re: New ld.elf_so from FreeBSD)
To: Bang Jun-Young <>
From: Charles Hannum <>
List: tech-toolchain
Date: 09/05/2002 21:39:44
Actually, there is another solution for C++ startup performance:
Solaris's `-z combreloc'.  It appears that BFD already sorts
relocations by symbol, so the only support necessary for this is in
ld.elf_so.  I've checked in some changes, for i386, `#ifdef
COMBRELOC', that implement this.  You can see that it's trivial.

Interestingly, I instrumented this and ran mozilla, and I see that
most of the lookups that benefit from it are to __pure_virtual.  The
actual numbers are below.

In principal, if ld(1) is doing its job correctly, this limits the
maximum number of lookups for a given symbol to 3 (1 for
R_TYPE(32/DIR32/ABS32/REFQUAD/whatever), 1 for R_TYPE(GLOB_DAT), and 1
for R_TYPE(JMP_SLOT) in the PLT).  The SymCache change limits it to 2
(since it affects everything except R_TYPE(JMP_SLOT)), at the expense
of temporary memory usage and some other overhead associated with

37116 matched __pure_virtual
 201 matched XtStrings
  74 matched JS_PropertyStub
  72 matched _PR_InvalidInt
  57 matched XtShellStrings
  54 matched FLG_NONE
  50 matched doCreate__14nsDOMClassInfoP18nsDOMClassInfoData
  49 matched doCreate__15nsHTMLElementSHP18nsDOMClassInfoData
  43 matched _XtInherit
  30 matched FLG_ZHTW
  26 matched _PR_InvalidStatus
   9 matched ParseLiteral__14BookmarkParserP14nsIRDFResourceR8nsStringPP10nsIRDFNode
   9 matched doCreate__11nsElementSHP18nsDOMClassInfoData
   7 matched js_InitObjectClass
   6 matched FLG_ZHCN
   6 matched doCreate__8nsNodeSHP18nsDOMClassInfoData
   5 matched FEI_x_mathematica5
   4 matched FEI_x_mathematica3
   4 matched FLG_JA
   4 matched FLG_KO
   4 matched FLG_WESTERN
   3 matched Create__17nsAboutRedirectorP11nsISupportsRC4nsIDPPv
   3 matched FEI_x_mathematica1
   3 matched FEI_x_mathematica2
   3 matched FEI_x_mathematica4
   3 matched ParseDate__14BookmarkParserP14nsIRDFResourceR8nsStringPP10nsIRDFNode
   2 matched _end
   2 matched js_SetProtoOrParent
   1 matched Create__13nsHttpHandlerP11nsISupportsRC4nsIDPPv
   1 matched Create__16nsPluginHostImplP11nsISupportsRC4nsIDPPv
   1 matched FEI_windows_1252
   1 matched FEI_x_mtextra
   1 matched XtMenuPopupAction
   1 matched _12nsXBLService$gClassLRUList
   1 matched _13nsProfileLock$mPidLockList
   1 matched _XimTransConf
   1 matched _jsd_context_list
   1 matched _pr_active_global_threadQ
   1 matched _pr_active_local_threadQ
   1 matched _pr_cpuQ
   1 matched _pr_freeStacks
   1 matched compositeClassRec
   1 matched doCreate__15nsCSSRuleListSHP18nsDOMClassInfoData
   1 matched doCreate__16nsCSSStyleDeclSHP18nsDOMClassInfoData
   1 matched js_InitExceptionClasses
   1 matched js_arguments_str
   1 matched js_false_str
   1 matched js_getter_str
   1 matched js_in_str
   1 matched js_instanceof_str
   1 matched js_null_str
   1 matched js_setter_str
   1 matched js_this_str
   1 matched js_true_str
   1 matched jsj_JavaConstructorWrapper
   1 matched uHitFormate0
   1 matched widgetClassRec