Skip to content

Conversation

@StephanTLavavej
Copy link
Member

Reported by: https://www.reddit.com/r/cpp/comments/wgb8xo/fun_times_with_msvc_functional/

This does two things:

  • <xhash> includes <xstring> for basic_string, <cstring> for strlen, and <cwchar> for wcslen, because it's defining non-Standard stdext machinery for <hash_map> and <hash_set>. This throughput cost is paid by everyone who drags in <xhash>, including highly indirect routes like <functional>. There's a simple way to avoid this (i.e. without adding a new sub-header to be included by <hash_meow>). Because we hard-deprecated <hash_meow> with an error-and-escape-hatch, we can guard the stdext machinery with that same escape hatch. Result: the stdext machinery and <xstring> etc. dependencies disappear for the vast majority of users, and are still available unchanged when activating the escape hatch.
    • This throughput improvement is inherently a source-breaking change for anyone who assumed that <unordered_meow> would make most of <string> available. As usual, the fix is to simply include <string>. Let's be daring and try to see if we can do this without totally breaking the world.
  • We were dragging stdext::hash_compare into std, contrary to our goal of keeping non-Standard identifiers out of std. The project that needed this, protobuf, was fixed almost 3.5 years ago. We should be able to eliminate this now.

@StephanTLavavej StephanTLavavej added the throughput Must compile faster label Aug 5, 2022
@StephanTLavavej StephanTLavavej requested a review from a team as a code owner August 5, 2022 05:18
Copy link
Contributor

@strega-nil-ms strega-nil-ms left a comment

Choose a reason for hiding this comment

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

Thank you so much! This is great.

@StephanTLavavej
Copy link
Member Author

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

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

Labels

throughput Must compile faster

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants