diff options
author | Sergey Andreenko <seandree@microsoft.com> | 2021-06-10 01:53:19 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-10 01:53:19 +0300 |
commit | 5106d587c0325f3191696d5da5a1ce75ebfffaa7 (patch) | |
tree | bf2e1d2f9d283f7e27e9cdf9b570208e65f0a297 /src/coreclr/ToolBox | |
parent | 175ad5f46554ac480ca93abcce175f695314ac98 (diff) |
fix spmi perfomance. (#53953)
Diffstat (limited to 'src/coreclr/ToolBox')
3 files changed, 10 insertions, 7 deletions
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shared/compileresult.cpp b/src/coreclr/ToolBox/superpmi/superpmi-shared/compileresult.cpp index 94ac3a50a36..729064aa1b0 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi-shared/compileresult.cpp +++ b/src/coreclr/ToolBox/superpmi/superpmi-shared/compileresult.cpp @@ -1096,7 +1096,10 @@ void CompileResult::repRecordCallSite(ULONG instrOffset, CORINFO_SIG_INFO* callS // The most call site records have only `methodHandle`, so creating two separate maps give us better perfomance // and smaller memory consumption. Note: we are not reading values from these maps during a normal replay. RecordCallSiteWithSignature = new LightWeightMap<DWORD, Agnostic_RecordCallSite>(); - RecordCallSiteWithoutSignature = new LightWeightMap<DWORD, DWORDLONG>(); + if (recordCallSitesWithoutSig) + { + RecordCallSiteWithoutSignature = new LightWeightMap<DWORD, DWORDLONG>(); + } } if (callSig != nullptr) @@ -1107,7 +1110,7 @@ void CompileResult::repRecordCallSite(ULONG instrOffset, CORINFO_SIG_INFO* callS value.methodHandle = CastHandle(methodHandle); RecordCallSiteWithSignature->Add(instrOffset, value); } - else + else if (recordCallSitesWithoutSig) { RecordCallSiteWithoutSignature->Add(instrOffset, CastHandle(methodHandle)); } diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shared/compileresult.h b/src/coreclr/ToolBox/superpmi/superpmi-shared/compileresult.h index 47dbc0a07ba..4c912d10b5a 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi-shared/compileresult.h +++ b/src/coreclr/ToolBox/superpmi/superpmi-shared/compileresult.h @@ -211,5 +211,7 @@ private: MemoryTracker* memoryTracker; Capture_AllocMemDetails allocMemDets; allocGCInfoDetails allocGCInfoDets; + + const bool recordCallSitesWithoutSig = false; // Set it to true if you want to use CallUtils::GetRecordedCallSiteInfo. }; #endif diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shared/lightweightmap.h b/src/coreclr/ToolBox/superpmi/superpmi-shared/lightweightmap.h index ed06e9fac4d..dee5d760e30 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi-shared/lightweightmap.h +++ b/src/coreclr/ToolBox/superpmi/superpmi-shared/lightweightmap.h @@ -385,11 +385,9 @@ public: if (numItems > 0) { - for (unsigned int i = numItems; i > insert; i--) - { - pKeys[i] = pKeys[i - 1]; - pItems[i] = pItems[i - 1]; - } + int countToMove = (numItems - insert); + memmove(&pKeys[insert+1], &pKeys[insert], countToMove * sizeof(pKeys[insert])); + memmove(&pItems[insert+1], &pItems[insert], countToMove * sizeof(pItems[insert])); } pKeys[insert] = key; |