-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[stdlib] Eliminate _HasherCore protocol #20198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@swift-ci benchmark |
This comment has been minimized.
This comment has been minimized.
43e9fd9
to
7a717d6
Compare
With the new String representation, this is likely a viable change now. |
@swift-ci please test |
@swift-ci please benchmark |
This comment has been minimized.
This comment has been minimized.
Build comment file:No performance and code size changesHow to read the dataThe tables contain differences in performance which are larger than 8% and differences in code size which are larger than 1%.If you see any unexpected regressions, you should consider fixing the regressions before you merge the PR. Noise: Sometimes the performance results (not code size!) contain false alarms. Unexpected regressions which are marked with '(?)' are probably noise. If you see regressions which you cannot explain you can try to run the benchmarks again. If regressions still show up, please consult with the performance team (@eeckstein). Hardware Overview
|
@swift-ci test |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
264be40
to
382807e
Compare
@swift-ci please smoke test and merge |
382807e
to
43f3431
Compare
@swift-ci smoke test and merge |
(This is a spinoff of #20185; it was created because eliminating
_HasherCore
used to cause a code size regression.)Hasher
only supports a single algorithm, so_HasherCore
is an unnecessary protocol. It wasn't ever intended to be ABI-visible; the expectation was thatHasher
would become a resilient struct, and internal details wouldn't become hardcoded in the ABI.Unfortunately
Hasher
resiliency did not happen, so we're setting its internal layout & types in stone. This PR sanitizes these internals, updating them to the brave new fragileHasher
world.Types that are implementation details of Hasher are now tucked away inside it, unnecessary generics are eliminated, names are made more sensible:
protocol _HasherCore
struct _HasherTailBuffer
struct Hasher._TailBuffer
struct _BufferingHasher<Core>
struct Hasher._Core
struct Hasher._Core
struct Hasher._State
Hasher._State
is low-level SipHash implementation; it includes the fragile hashing state and internal operations that update it.Hasher._TailBuffer
is a small buffer collecting bytes into word-size chunks that can be fed to_State
.Hasher._Core
consists of a tail buffer and a state; it implements low-level Hasher operations. (It's a little like_StringGuts
.) PublicHasher
operations call into it.