[llvm] [memprof] Improve deserialization performance in V3 (PR #94787)

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 7 16:37:38 PDT 2024


================
@@ -494,17 +494,43 @@ static uint64_t writeMemProfFrames(
 static llvm::DenseMap<memprof::FrameId, memprof::LinearFrameId>
 writeMemProfFrameArray(
     ProfOStream &OS,
-    llvm::MapVector<memprof::FrameId, memprof::Frame> &MemProfFrameData) {
+    llvm::MapVector<memprof::FrameId, memprof::Frame> &MemProfFrameData,
+    llvm::DenseMap<memprof::FrameId, memprof::FrameStat> &FrameHistogram) {
   // Mappings from FrameIds to array indexes.
   llvm::DenseMap<memprof::FrameId, memprof::LinearFrameId> MemProfFrameIndexes;
 
-  // Sort the FrameIDs for stability.
+  // Compute the order in which we serialize Frames.  The order does not matter
+  // in terms of correctness, but we still compute it for two reasons:
+  //
+  // - Stability of the output: If we sort by FrameIds at least, then the output
----------------
teresajohnson wrote:

This is largely not done afaict? I guess as a fallback tie breaker, but maybe better to mention that briefly at the end of the next paragraph?

https://github.com/llvm/llvm-project/pull/94787


More information about the llvm-commits mailing list