[all-commits] [llvm/llvm-project] 9a6ae9: [lit] Avoid calling realpath() for every printed m...

Alexander Richardson via All-commits all-commits at lists.llvm.org
Mon Oct 19 08:22:29 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 9a6ae91128fa53b427f2da9765f042faed5533a6
      https://github.com/llvm/llvm-project/commit/9a6ae91128fa53b427f2da9765f042faed5533a6
  Author: Alex Richardson <Alexander.Richardson at cl.cam.ac.uk>
  Date:   2020-10-19 (Mon, 19 Oct 2020)

  Changed paths:
    M llvm/utils/lit/lit/LitConfig.py

  Log Message:
  -----------
  [lit] Avoid calling realpath() for every printed message

I did some profiling of lit while trying to optimize the libc++ test
startup for remote hosts and it turns out that there is a realpath() call
for every message printed and this shows up in the profile.
The inspect.getframeinfo() function calls realpath() internally and
moreover we don't need most of the other information returned from it.
This patch uses inspect.getsourcefile() and os.path.abspath() to remove
../ from the path instead. Not resolving symlinks reduces the startup time
for running a single test with lit by about 50ms for me.

Reviewed By: ldionne, yln
Differential Revision: https://reviews.llvm.org/D89186




More information about the All-commits mailing list