[all-commits] [llvm/llvm-project] 7f86bb: [llvm] Call reserve before push_back in a loop

Rose via All-commits all-commits at lists.llvm.org
Thu Dec 8 00:43:05 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7f86bb0a713cbd2643c4ed5da9bd92d9b24eaa72
      https://github.com/llvm/llvm-project/commit/7f86bb0a713cbd2643c4ed5da9bd92d9b24eaa72
  Author: Gregory Alfonso <gfunni234 at gmail.com>
  Date:   2022-12-08 (Thu, 08 Dec 2022)

  Changed paths:
    M llvm/include/llvm/Testing/Support/Error.h
    M llvm/lib/Support/VirtualFileSystem.cpp
    M llvm/tools/llvm-cov/CodeCoverage.cpp
    M llvm/tools/llvm-cov/CoverageReport.cpp
    M llvm/unittests/ADT/DenseMapTest.cpp
    M llvm/utils/TableGen/GlobalISelEmitter.cpp
    M llvm/utils/TableGen/OptParserEmitter.cpp

  Log Message:
  -----------
  [llvm] Call reserve before push_back in a loop

It is generally good practice, if you know how big the vector is going to be in the end, to reserve before continually calling "push_back" or "emplace_back"

Reviewed By: MaskRay

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




More information about the All-commits mailing list