Read partial vector first [breaking change] #6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context
Often, the input message does not fit a whole number of SIMD vectors (for 128-bit SIMD, it means the message size in bits is not a multiple of 128). Because of this, we currently often finish by reading a "partial" vector. To do this at high-speed, a small function verifies that we can read beyond the bounds of the input message without risking a segfault or some other dramatic exception (using the page size).
In practice, this works well, but this check as a small overhead. It turns out we can simply start first by reading the partial vector, and only then read a whole number of blocks. This allows us to skip the safety check in some situations because we aren't reading beyond the bounds of the message anymore (because we have at least one message block after this).
This change is about reading first the partial vector. This change will help boost performances, but will however break the stability (meaning that from this change generates hashes will be different from the hash generated by previous versions of the algorithm, for the same inputs)
Todo