Browse Source

Make MinHeap::initialize_heap much more efficient

Ian Goldberg 2 years ago
parent
commit
18a701b9b5
1 changed files with 7 additions and 11 deletions
  1. 7 11
      heap.cpp

+ 7 - 11
heap.cpp

@@ -503,18 +503,14 @@ void MinHeap::initialize(MPCTIO tio, yield_t & yield) {
 
 
 void MinHeap::initialize_heap(MPCTIO tio, yield_t & yield) {
 void MinHeap::initialize_heap(MPCTIO tio, yield_t & yield) {
     auto HeapArray = oram.flat(tio, yield);
     auto HeapArray = oram.flat(tio, yield);
-    std::vector<coro_t> coroutines;
+
+    HeapArray.explicitonly(true);
     for (size_t j = 1; j <= num_items; ++j) {
     for (size_t j = 1; j <= num_items; ++j) {
-        coroutines.emplace_back(
+        RegAS v;
-            [&tio, &HeapArray, j](yield_t &yield) {
+        v.ashare = j * tio.player();
-            auto Acoro = HeapArray.context(yield);
+        HeapArray[j] = v;
-            RegAS v;
-            v.ashare = j * tio.player();
-            Acoro[j] = v;
-        }
-       );
     }
     }
-  run_coroutines(tio, coroutines);
+    HeapArray.explicitonly(false);
 }
 }
 
 
 
 
@@ -867,4 +863,4 @@ void Heap(MPCIO & mpcio,
         if(run_sanity == 1 && n_extracts != 0) tree.verify_heap_property(tio, yield);
         if(run_sanity == 1 && n_extracts != 0) tree.verify_heap_property(tio, yield);
     }
     }
     );
     );
-}
+}