[PATCH] D145464: [BOLT][NFC] Use llvm::is_contained

Amir Ayupov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 14 15:51:18 PDT 2023


Amir added a comment.

In D145464#4194916 <https://reviews.llvm.org/D145464#4194916>, @kuhar wrote:

> FYI, by a quick scan through the patch, it seems like a likely pessimization. Currently, llvm::is_contained performs a linear scan to find the element, while `.find(x)` is typically O(1) or O(log n). Related discussion on this topic: https://reviews.llvm.org/D146061

Thanks for a heads up! It'd be great to specialize `is_contained` for const- or log-time lookup.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145464



More information about the llvm-commits mailing list