[PATCH] D110018: [lld-macho] Speed up markLive()

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 1 23:07:07 PST 2022


MaskRay added a comment.
Herald added a project: All.

How does work-stealing queue compare with oneTBB `tbb::parallel_for_each` with a feeder?



================
Comment at: lld/MachO/MarkLive.cpp:230
+    size_t start = idx * d;
+    size_t end = start + d - 1;
+    bool skip = false;
----------------
open-ended intervals are usually easy to work with and less error-prone


================
Comment at: lld/MachO/MarkLive.cpp:251
+  for (auto &thread : threads) {
+    thread.join();
+  }
----------------
https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements


================
Comment at: lld/MachO/WorkStealingQueue.h:76
+  // FIXME: may not need this.
+  std::vector<internal::Node<T> *> retired; // retired nodes
+};
----------------
I find that `SmallVector<X, 0>` is usually more efficient and compiles to less code.


================
Comment at: lld/MachO/WorkStealingQueue.h:82
+
+#include "WorkStealingQueue.inc"
+
----------------
Why is the `.inc` split from the `.h` file?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110018/new/

https://reviews.llvm.org/D110018



More information about the llvm-commits mailing list