Skip to content

ExecutionManager::GetRangeSection performs a linear search over list of loaded assemblies #8393

Closed
@briansull

Description

@briansull

PerfView indicates that significant time can be spent in this method when we create a Delegate:
The MusicStore application has over 130 managed assemblies loaded.
Eliminating this search can improve steady state transaction time by ~3%

|+ coreclr!COMDelegate::DelegateConstruct
We have to perform two IP lookups in DelegateConstruct

       FCIMPL3(void, COMDelegate::DelegateConstruct, Object* refThisUNSAFE, Object* targetUNSAFE, PCODE method)
(line 1914)
219.0 |    MethodDesc * pCreatorMethod = ExecutionManager::GetCodeMethodDesc((PCODE)pRetAddr);
(line 1933)
159.0 |    MethodDesc *pMethOrig = Entry2MethodDesc(method, pRealMT);

Both of these calls eventually resolve to: ExecutionManager::GetRangeSection

RangeSection* ExecutionManager::GetRangeSection(TADDR addr)
. . . 
          while (pCurr != NULL)
           {
               // See if addr is in [pCurr->LowAddress .. pCurr->HighAddress)
 12.0 |        if (pCurr->LowAddress <= addr)
               {
                   // Since we are sorted, once pCurr->HighAddress is less than addr
                   // then all subsequence ones will also be lower, so we are done.
  3.0 |            if (addr >= pCurr->HighAddress)
                   {
                       // we'll return NULL and put pLast into pLastUsed
                       pCurr = NULL;
                   }
                   else
                   {
                       // addr must be in [pCurr->LowAddress .. pCurr->HighAddress)
                       _ASSERTE((pCurr->LowAddress <= addr) && (addr < pCurr->HighAddress));
       
                       // Found the matching RangeSection
                       // we'll return pCurr and put it into pLastUsed
                       pLast = pCurr;
                   }
       
                   break;
               }
320.0 |        pLast = pCurr;
 57.0 |        pCurr = pCurr->pnext;
           }

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions