[all-commits] [llvm/llvm-project] dc3b51: [llvm][mustache] Optimize accessor splitting with ...

Paul Kirth via All-commits all-commits at lists.llvm.org
Tue Nov 4 15:56:22 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: dc3b5141cdf704bec28edeed78d6d72ebe0444ae
      https://github.com/llvm/llvm-project/commit/dc3b5141cdf704bec28edeed78d6d72ebe0444ae
  Author: Paul Kirth <paulkirth at google.com>
  Date:   2025-11-04 (Tue, 04 Nov 2025)

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

  Log Message:
  -----------
  [llvm][mustache] Optimize accessor splitting with a single pass (#159198)

The splitMustacheString function previously used a loop of
StringRef::split and StringRef::trim. This was inefficient as
it scanned each segment of the accessor string multiple times.

This change introduces a custom splitAndTrim function that
performs both operations in a single pass over the string,
reducing redundant work and improving performance, most notably
in the number of CPU cycles executed.

| Metric | Baseline | Optimized | Change |
| --- | --- | --- | --- |
| Time (ms) | 35\.57 | 35\.36 | \-0.59% |
| Cycles | 34\.91M | 34\.26M | \-1.86% |
| Instructions | 85\.54M | 85\.24M | \-0.35% |
| Branch Misses | 111\.9K | 112\.2K | \+0.27% |
| Cache Misses | 242\.1K | 239\.9K | \-0.91% |



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