[all-commits] [llvm/llvm-project] f54616: [lld-macho] Don't create entries in isecPriorities...

Daniel Bertalan via All-commits all-commits at lists.llvm.org
Wed Sep 28 07:55:56 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f546165754d41353010d34b8d4c9f381434ffc68
      https://github.com/llvm/llvm-project/commit/f546165754d41353010d34b8d4c9f381434ffc68
  Author: Daniel Bertalan <dani at danielbertalan.dev>
  Date:   2022-09-28 (Wed, 28 Sep 2022)

  Changed paths:
    M lld/MachO/Writer.cpp

  Log Message:
  -----------
  [lld-macho] Don't create entries in isecPriorities during sorting (NFC)

If a value for a given key is not present, `DenseMap::operator[]`
default-constructs one, which is wasteful when we don't do anything with
it afterwards. Fix it by calling `lookup()` instead which only returns
the default value, but does not modify the map.

This speeds up linking a fair bit when only a small portion of all
sections are specified in the order file, like in the case of Chromium
Framework:

      N           Min           Max        Median           Avg        Stddev
  x  25      3.727684     3.8808699      3.753552     3.7702461     0.0397282
  +  25     3.6469049     3.7523289     3.6764321     3.6841622   0.025525047
  Difference at 95.0% confidence
  	-0.0860839 +/- 0.0189924
  	-2.28324% +/- 0.503745%
  	(Student's t, pooled s = 0.0333906)

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




More information about the All-commits mailing list