[all-commits] [llvm/llvm-project] 67509f: [llvm][mustache] Avoid excessive hash lookups in E...

Paul Kirth via All-commits all-commits at lists.llvm.org
Thu Sep 25 17:35:26 PDT 2025


  Branch: refs/heads/users/ilovepi/mustache-escapestream-opt
  Home:   https://github.com/llvm/llvm-project
  Commit: 67509f63b5f071fe91c39a9d29403e8d7ba46f6e
      https://github.com/llvm/llvm-project/commit/67509f63b5f071fe91c39a9d29403e8d7ba46f6e
  Author: Paul Kirth <pk1574 at gmail.com>
  Date:   2025-09-25 (Thu, 25 Sep 2025)

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

  Log Message:
  -----------
  [llvm][mustache] Avoid excessive hash lookups in EscapeStringStream

The naive char-by-char lookup performed OK, but we can skip ahead to the
next match, avoiding all the extra hash lookups in the key map. Likely
there is a faster method than this, but its already a 42% win in the
BM_Mustache_StringRendering/Escaped benchmark, and an order of magnitude
improvement for BM_Mustache_LargeOutputString.

 Benchmark                  Before (ns)   After (ns)  Speedup
 -------------------------  -----------  -----------  -------
 StringRendering/Escaped     29,440,922   16,583,603     ~44%
 LargeOutputString           15,139,251      929,891     ~94%
 HugeArrayIteration         102,148,245   95,943,960      ~6%
 PartialsRendering          308,330,014  303,556,563    ~1.6%

Unreported benchmarks, like those for parsing, had no significant change.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list