[all-commits] [llvm/llvm-project] 7d950f: [NFC][TLI] Replace std::lower_bound call in getLib...

Dhruv Chawla via All-commits all-commits at lists.llvm.org
Tue Aug 15 10:07:51 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7d950f040e3da66ec83f91b58d8c2220483d6335
      https://github.com/llvm/llvm-project/commit/7d950f040e3da66ec83f91b58d8c2220483d6335
  Author: Dhruv Chawla <44582521+dc03 at users.noreply.github.com>
  Date:   2023-08-15 (Tue, 15 Aug 2023)

  Changed paths:
    M llvm/lib/Analysis/TargetLibraryInfo.cpp

  Log Message:
  -----------
  [NFC][TLI] Replace std::lower_bound call in getLibFunc with DenseMap lookup

While std::lower_bound takes logarithmic time (relative to the length of
the array) to execute, DenseMap gives better performance characteristics
as it traverses few (if any) elements when collisions do occur,
especially when the number of elements are known in advance.

This gives a speedup of 0.24%:
https://llvm-compile-time-tracker.com/compare.php?from=ac00cca3d9c6c3e9118ebbe47aa5b3ba1ee7404f&to=7f3d4c8ce8cee3a236a2328e46b2a8374672b46e&stat=instructions:u

Differential Revision: https://reviews.llvm.org/D157951




More information about the All-commits mailing list