Skip to content
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

Improve cpuid-bool efficiency #86

Merged
merged 5 commits into from
Nov 29, 2020
Merged

Improve cpuid-bool efficiency #86

merged 5 commits into from
Nov 29, 2020

Conversation

newpavlov
Copy link
Member

@newpavlov newpavlov commented Nov 28, 2020

The new API creates a module which contains InitToken zero sized type. The only way to create a value of this type is via functions which ensure that initialization code has been executed. It should be slightly more efficient for our use-cases, since initialization branch can be eliminated from methods which work with initialized algorithm (e.g. update and encrypt_blocks/decrypt_blocks).

In future it could be beneficial to add "cpuid enums", i.e. macro which would generate code not for a bool, but for a user-specified enum.

@newpavlov newpavlov requested a review from tarcieri November 28, 2020 02:19
@newpavlov
Copy link
Member Author

Clippy errors are unrelated to changes in this PR.

Copy link
Member

@tarcieri tarcieri left a comment

Choose a reason for hiding this comment

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

Okay sorry, it took me awhile to figure out this is all working as expected, but now I've tested it out empirically and it seems to be working the way you described.

@tarcieri
Copy link
Member

Fixed clippy in #87 and rebased. Should be good to merge/release now.

@newpavlov newpavlov merged commit be91954 into master Nov 29, 2020
@newpavlov newpavlov deleted the cpuid_bool2 branch November 29, 2020 17:40
@tarcieri
Copy link
Member

@newpavlov can you publish the crate? I don't have access.

@newpavlov
Copy link
Member Author

I plan to do it on the 1st of December as specified in the changelog. I will add you to the owners list a bit later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants