[all-commits] [llvm/llvm-project] 37048d: Cache memory buffer's name length

serge-sans-paille via All-commits all-commits at lists.llvm.org
Thu Dec 1 00:43:34 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 37048d04d8eefd24af4871bd9428f389eaad0abe
      https://github.com/llvm/llvm-project/commit/37048d04d8eefd24af4871bd9428f389eaad0abe
  Author: serge-sans-paille <sguelton at mozilla.com>
  Date:   2022-12-01 (Thu, 01 Dec 2022)

  Changed paths:
    M llvm/lib/Support/MemoryBuffer.cpp

  Log Message:
  -----------
  Cache memory buffer's name length

This avoids repeated calls to strlen while we already know its value.

When preprocessing sqlite3.c, this gives a surprising 2% speedup.

Full benchmark available here:

https://llvm-compile-time-tracker.com/compare.php?from=d14c2d408dccd8c6defa7d151e9a96be3cac8cc3&to=04f0641c1cbdcd0bdbd11cd910ca6091420bf52e&stat=instructions:u

Recommit 1824432174b3166b40bce59477beb5821170748e, with restored '\0' at the end of buffer name.

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




More information about the All-commits mailing list