[PR #11725] [MERGED] Introduce new TIL string helpers, teach older ones to use wmemcmp #28716

Open
opened 2026-01-31 09:30:20 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/11725
Author: @lhecker
Created: 11/10/2021
Status: Merged
Merged: 11/17/2021
Merged by: @undefined

Base: mainHead: dev/lhecker/optimization-wmemcmp


📝 Commits (2)

  • 0a1ee7e Optimize wide string comparisons with memcmp
  • a1462b1 Revert most changes, keep til::equal

📊 Changes

2 files changed (+52 additions, -33 deletions)

View changed files

📝 src/inc/operators.hpp (+0 -20)
📝 src/inc/til/string.h (+52 -13)

📄 Description

til::equals:
At the time of writing wmemcmp() is not an intrinsic for MSVC,
but the STL uses it to implement wide string comparisons.
This produces 3x the assembly per comparison and increases
runtime by 2-3x for strings of medium length (16 characters)
and 5x or more for long strings (128 characters or more).
See: https://github.com/microsoft/STL/issues/2289

Additionally a number of case insensitive, locale unaware
helpers for prefix/suffix comparisons are introduced.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/11725 **Author:** [@lhecker](https://github.com/lhecker) **Created:** 11/10/2021 **Status:** ✅ Merged **Merged:** 11/17/2021 **Merged by:** [@undefined](undefined) **Base:** `main` ← **Head:** `dev/lhecker/optimization-wmemcmp` --- ### 📝 Commits (2) - [`0a1ee7e`](https://github.com/microsoft/terminal/commit/0a1ee7eabf840894b774f6601284cee87138e43e) Optimize wide string comparisons with memcmp - [`a1462b1`](https://github.com/microsoft/terminal/commit/a1462b192bc4bad2443190c59bbe4150d1fac173) Revert most changes, keep til::equal ### 📊 Changes **2 files changed** (+52 additions, -33 deletions) <details> <summary>View changed files</summary> 📝 `src/inc/operators.hpp` (+0 -20) 📝 `src/inc/til/string.h` (+52 -13) </details> ### 📄 Description til::equals: At the time of writing wmemcmp() is not an intrinsic for MSVC, but the STL uses it to implement wide string comparisons. This produces 3x the assembly _per_ comparison and increases runtime by 2-3x for strings of medium length (16 characters) and 5x or more for long strings (128 characters or more). See: https://github.com/microsoft/STL/issues/2289 Additionally a number of case insensitive, locale unaware helpers for prefix/suffix comparisons are introduced. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:30:20 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#28716