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

Use ternary operator in stfn #2941

Merged
merged 1 commit into from
Aug 11, 2021
Merged

Use ternary operator in stfn #2941

merged 1 commit into from
Aug 11, 2021

Conversation

dapplion
Copy link
Contributor

Motivation

Same logic can be achieved with the ternary operator, allowing variables to be constant

Description

  • Use ternary operator in slashValidator
  • Use ternary operator in epochCtx
  • Read effectiveBalance once

@codeclimate
Copy link

codeclimate bot commented Aug 10, 2021

Code Climate has analyzed commit aa6b520 and detected 0 issues on this pull request.

View more on Code Climate.

@github-actions
Copy link
Contributor

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 166c0ee Previous: c09ea9a Ratio
getCommitteeAssignments - req 1000 vs - 250000 vc 7.8613 ms/op 9.2084 ms/op 0.85
processBlock altair 250000 vs - 7PWei - maxed ops 420.06 ms/op 563.59 ms/op 0.75
processBlock altair 250000 vs - 7PWei - average 150.51 ms/op 220.05 ms/op 0.68
epoch altair - 250000 vs - 7PWei - processInactivityUpdates 2.2828 s/op 2.6754 s/op 0.85
epoch altair - 250000 vs - 7PWei - processRewardsAndPenalties 957.37 ms/op 1.1298 s/op 0.85
epoch altair - 250000 vs - 7PWei - processParticipationFlagUpdates 456.98 ms/op 578.71 ms/op 0.79
processBlock phase0 250000 vs - 7PWei - maxed ops 204.52 ms/op 240.26 ms/op 0.85
processBlock phase0 250000 vs - 7PWei - average 24.600 ms/op 30.951 ms/op 0.79
epoch phase0 - 250000 vs - 7PWei - beforeProcessEpoch 1.6340 s/op 2.0031 s/op 0.82
epoch phase0 - 250000 vs - 7PWei - processRewardsAndPenalties 683.57 ms/op 918.98 ms/op 0.74
epoch phase0 - 250000 vs - 7PWei - processEffectiveBalanceUpdates 52.993 ms/op 135.53 ms/op 0.39
getAttestationDeltas - 250000 vs - 7PWei 114.67 ms/op 124.54 ms/op 0.92
processSlots - 250000 vs - 7PWei - 32 empty slots 3.0506 s/op 3.6104 s/op 0.84
shuffle list - 16384 els 24.979 ms/op 30.941 ms/op 0.81
shuffle list - 250000 els 333.36 ms/op 298.32 ms/op 1.12
getPubkeys - persistent - req 1000 vs - 250000 vc 17.232 us/op 20.070 us/op 0.86
BLS verify - blst-native 1.8629 ms/op 2.3405 ms/op 0.80
BLS verifyMultipleSignatures 3 - blst-native 3.8088 ms/op 4.8100 ms/op 0.79
BLS verifyMultipleSignatures 8 - blst-native 8.2015 ms/op 10.355 ms/op 0.79
BLS verifyMultipleSignatures 32 - blst-native 32.505 ms/op 37.961 ms/op 0.86
BLS aggregatePubkeys 32 - blst-native 40.352 us/op 78.616 us/op 0.51
BLS aggregatePubkeys 128 - blst-native 155.82 us/op 210.14 us/op 0.74
getAttestationsForBlock 79.173 ms/op 89.045 ms/op 0.89
validate gossip signedAggregateAndProof - struct 4.5090 ms/op 5.7115 ms/op 0.79
validate gossip signedAggregateAndProof - treeBacked 4.4618 ms/op 5.6947 ms/op 0.78
validate gossip attestation - struct 2.0974 ms/op 2.6666 ms/op 0.79
validate gossip attestation - treeBacked 2.1294 ms/op 2.6806 ms/op 0.79

by benchmarkbot/action

@twoeths twoeths merged commit 53f0c9e into master Aug 11, 2021
@twoeths twoeths deleted the dapplion/slash-constant branch August 11, 2021 00:42
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.

None yet

3 participants