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

perf: use bitwise operations in add/sub impls #407

Merged
merged 1 commit into from
Dec 4, 2024

Conversation

DaniPopes
Copy link
Contributor

@DaniPopes DaniPopes requested a review from prestwich as a code owner November 30, 2024 14:50
@prestwich
Copy link
Collaborator

CI failure caused by this:
paritytech/parity-scale-codec#662

@prestwich
Copy link
Collaborator

gonna hold this open a couple days to see if parity will patch

@recmo
Copy link
Owner

recmo commented Dec 3, 2024

Is there a perf difference between using | and || on a bool?

@recmo
Copy link
Owner

recmo commented Dec 3, 2024

Ah, looks like there is some issue. Rustc has a similar patch: rust-lang/rust@9836196

rust-lang/rust#85532 (comment)

Generally these functions should mirror the bigint helpers from rustc untill they stabelize.

@prestwich
Copy link
Collaborator

parity has yanked [email protected] and CI is passing so this is good to go

@prestwich prestwich merged commit b91e6f7 into recmo:main Dec 4, 2024
17 checks passed
@DaniPopes DaniPopes deleted the add-bitwise-ops branch December 4, 2024 21:46
@scottmcm
Copy link

scottmcm commented Dec 5, 2024

Is there a perf difference between using | and || on a bool?

a | b is BitOr(a, b) internally, whereas a || b is if a { true } else { b } as control-flow, not an operator.

Ideally there wouldn't be a difference, but optimizers are imperfect. In places where you're μoptimizing and would prefer eager behaviour, | can help encourage that.

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.

4 participants