KEMBAR78
Optimize equality comparison of two empty `string_view`s by YexuanXiao · Pull Request #4904 · microsoft/STL · GitHub
Skip to content

Conversation

@YexuanXiao
Copy link
Contributor

@YexuanXiao YexuanXiao commented Aug 22, 2024

Fixes #3310.

@YexuanXiao YexuanXiao requested a review from a team as a code owner August 22, 2024 18:49
@CaseyCarter CaseyCarter added the performance Must go faster label Aug 22, 2024
@StephanTLavavej StephanTLavavej self-assigned this Aug 22, 2024
Copy link
Contributor

@CaseyCarter CaseyCarter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor nits that I'll apply.

@StephanTLavavej StephanTLavavej changed the title Optimize equality comparison of two empty string_views (#3310) Optimize equality comparison of two empty string_views Aug 23, 2024
@StephanTLavavej StephanTLavavej removed their assignment Aug 23, 2024
@StephanTLavavej
Copy link
Member

Thanks, this is great! 😻 I pushed a commit for trivial naming nitpicks, and verified that there's a significant speedup for empty comparisons (I observed 1.7x, from 37.4 ns down to 22.0 ns).

We merge PRs to our GitHub and MSVC-internal repos simultaneously in a semi-manual process, batched up to save time. Your PR will be part of the next batch. I'll post comments here as I prepare this for merging!

@StephanTLavavej StephanTLavavej self-assigned this Aug 25, 2024
@StephanTLavavej
Copy link
Member

I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.

@StephanTLavavej StephanTLavavej merged commit d1f63f3 into microsoft:main Aug 25, 2024
@StephanTLavavej
Copy link
Member

Thanks for this significant performance improvement - it's a small change but it affects extremely common operations (both string and string_view). Amazing for a first-time contribution! 😻 🚀 🎉

This is expected to ship in VS 2022 17.12 Preview 3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Must go faster

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Optimize string_view::operator== when comparing 2 empty string_views

3 participants