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

Force name functions #2867

Merged
merged 6 commits into from
Jul 22, 2021
Merged

Force name functions #2867

merged 6 commits into from
Jul 22, 2021

Conversation

dapplion
Copy link
Contributor

@dapplion dapplion commented Jul 21, 2021

Motivation

Anonymous functions make CPU profiling much harder. If a hot function happens to be anonymous it will show up in the profile as (anonymous).

Description

  • Add eslint rule to force named functions.
  • Change arrow functions to regular functions where applicable.

Closes #2227

Extra

Found two tests that didn't had the .test.ts extension. Fixed that

@github-actions github-actions bot added CLI scope-networking All issues related to networking, gossip, and libp2p. labels Jul 21, 2021
@lgtm-com
Copy link

lgtm-com bot commented Jul 21, 2021

This pull request fixes 1 alert when merging bc3dd3d into 9453c73 - view on LGTM.com

fixed alerts:

  • 1 for Unused variable, import, function or class

@github-actions
Copy link
Contributor

github-actions bot commented Jul 21, 2021

Performance Report

✔️ no performance regression detected

🚀🚀 Significant benchmark improvement detected

Benchmark suite Current: 394ae19 Previous: 5428329 Ratio
aggregationBits - 2048 els - zipIndexesInBitList 70.973 us/op 236.17 us/op 0.30
Full benchmark results
Benchmark suite Current: 394ae19 Previous: 5428329 Ratio
getCommitteeAssignments - req 1000 vs - 250000 vc 9.4115 ms/op 8.2720 ms/op 1.14
epoch altair - 250000 vs - 7PWei - processJustificationAndFinalization 328.00 us/op 214.96 us/op 1.53
epoch altair - 250000 vs - 7PWei - processInactivityUpdates 2.6434 s/op 2.4226 s/op 1.09
epoch altair - 250000 vs - 7PWei - processRewardsAndPenalties 1.0479 s/op 822.39 ms/op 1.27
epoch altair - 250000 vs - 7PWei - processRegistryUpdates 22.296 us/op 16.587 us/op 1.34
epoch altair - 250000 vs - 7PWei - processSlashings 77.629 us/op 60.086 us/op 1.29
epoch altair - 250000 vs - 7PWei - processEth1DataReset 1.0890 us/op 795.00 ns/op 1.37
epoch altair - 250000 vs - 7PWei - processEffectiveBalanceUpdates 43.836 ms/op 42.917 ms/op 1.02
epoch altair - 250000 vs - 7PWei - processSlashingsReset 28.415 us/op 30.373 us/op 0.94
epoch altair - 250000 vs - 7PWei - processRandaoMixesReset 71.658 us/op 26.866 us/op 2.67
epoch altair - 250000 vs - 7PWei - processHistoricalRootsUpdate 4.3610 us/op 1.6470 us/op 2.65
epoch altair - 250000 vs - 7PWei - processParticipationFlagUpdates 340.25 ms/op 243.01 ms/op 1.40
epoch altair - 250000 vs - 7PWei - processSyncCommitteeUpdates 1.0050 us/op 1.5800 us/op 0.64
epoch altair - 250000 vs - 7PWei - prepareEpochProcessState 813.98 ms/op 596.54 ms/op 1.36
Process block - 250000 vs - 7PWei - with 0 validator exit 765.30 us/op 656.55 us/op 1.17
Process block - 250000 vs - 7PWei - with 1 validator exit 26.733 ms/op 23.500 ms/op 1.14
Process block - 250000 vs - 7PWei - with 16 validator exits 38.949 ms/op 24.167 ms/op 1.61
epoch phase0 - 250000 vs - 7PWei - processJustificationAndFinalization 96.038 us/op 91.775 us/op 1.05
epoch phase0 - 250000 vs - 7PWei - processRewardsAndPenalties 630.96 ms/op 556.80 ms/op 1.13
epoch phase0 - 250000 vs - 7PWei - processRegistryUpdates 23.252 us/op 13.441 us/op 1.73
epoch phase0 - 250000 vs - 7PWei - processSlashings 57.007 us/op 37.231 us/op 1.53
epoch phase0 - 250000 vs - 7PWei - processFinalUpdates 43.982 ms/op 54.595 ms/op 0.81
epoch phase0 - 250000 vs - 7PWei - prepareEpochProcessState 1.2273 s/op 979.98 ms/op 1.25
getAttestationDeltas - 250000 vs - 7PWei 90.148 ms/op 102.20 ms/op 0.88
processSlots - 250000 vs - 7PWei - 32 empty slots 6.6947 s/op 6.4942 s/op 1.03
shuffle list - 16384 els 1.8225 ms/op 2.7254 ms/op 0.67
shuffle list - 250000 els 25.663 ms/op 40.169 ms/op 0.64
aggregationBits - 2048 els - readonlyValues 293.27 us/op 583.42 us/op 0.50
aggregationBits - 2048 els - zipIndexesInBitList 70.973 us/op 236.17 us/op 0.30
ssz.Root.equals 1.4280 us/op 2.2180 us/op 0.64
getPubkeys - persistent - req 1000 vs - 250000 vc 20.616 us/op 18.468 us/op 1.12
BLS verify - blst-native 2.4400 ms/op 1.8719 ms/op 1.30
BLS verifyMultipleSignatures 3 - blst-native 4.7184 ms/op 3.8314 ms/op 1.23
BLS verifyMultipleSignatures 8 - blst-native 10.332 ms/op 8.2408 ms/op 1.25
BLS verifyMultipleSignatures 32 - blst-native 38.114 ms/op 29.855 ms/op 1.28
BLS aggregatePubkeys 32 - blst-native 50.025 us/op 42.745 us/op 1.17
BLS aggregatePubkeys 128 - blst-native 188.97 us/op 155.66 us/op 1.21
validate gossip signedAggregateAndProof - struct 5.4423 ms/op 6.4254 ms/op 0.85
validate gossip signedAggregateAndProof - treeBacked 5.3907 ms/op 4.0712 ms/op 1.32
validate gossip attestation - struct 2.5074 ms/op 1.8757 ms/op 1.34
validate gossip attestation - treeBacked 2.5675 ms/op 1.9127 ms/op 1.34

by benchmarkbot/action

@lgtm-com
Copy link

lgtm-com bot commented Jul 22, 2021

This pull request fixes 2 alerts when merging 821e3ba into 5428329 - view on LGTM.com

fixed alerts:

  • 2 for Unused variable, import, function or class

@lgtm-com
Copy link

lgtm-com bot commented Jul 22, 2021

This pull request fixes 2 alerts when merging b349f15 into 5428329 - view on LGTM.com

fixed alerts:

  • 2 for Unused variable, import, function or class

@wemeetagain wemeetagain merged commit 7e00bf4 into master Jul 22, 2021
@wemeetagain wemeetagain deleted the dapplion/named-functions branch July 22, 2021 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope-networking All issues related to networking, gossip, and libp2p.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Don't use anonymous functions 🙏
2 participants