[all-commits] [llvm/llvm-project] 03909c: [ELF] Remove StringRefZ

Fangrui Song via All-commits all-commits at lists.llvm.org
Wed Jan 19 20:09:59 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 03909c4400b585c1991e59359b4155d72a4f19ca
      https://github.com/llvm/llvm-project/commit/03909c4400b585c1991e59359b4155d72a4f19ca
  Author: Fangrui Song <i at maskray.me>
  Date:   2022-01-19 (Wed, 19 Jan 2022)

  Changed paths:
    M lld/ELF/InputFiles.cpp
    M lld/ELF/Symbols.h

  Log Message:
  -----------
  [ELF] Remove StringRefZ

StringRefZ does not improve performance. Non-local symbols always have eagerly
computed nameSize. Most local symbols's lengths will be updated in either:

* shouldKeepInSymtab
* SymbolTableBaseSection::addSymbol

Its benefit is offsetted by strlen in every call site (sums up to 5KiB code in a
release x86-64 build), so using StringRefZ may be slower.

In a -s link (uncommon) there is minor speedup, like ~0.3% for clang and chrome.

Reviewed By: alexander-shaposhnikov

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




More information about the All-commits mailing list