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

deps: update fastify to v4.26.2 #6626

Merged
merged 7 commits into from
Apr 4, 2024
Merged

deps: update fastify to v4.26.2 #6626

merged 7 commits into from
Apr 4, 2024

Conversation

nflaig
Copy link
Member

@nflaig nflaig commented Apr 3, 2024

Motivation

The latest version includes proper support for returning Uint8Array from handler and will efficiently convert it to a Buffer internally without copying the underlying ArrayBuffer.

The current approach we use is copying it instead which is not ideal

return Buffer.from(response);

But I think we can keep this as is for now. I mainly want to test against latest fastify version on the api client refactor branch without increasing the diff there even more by updating dependencies.

Description

Update fastify to v4.26.2 which includes fix for returning Uint8Array from handlers (fastify/fastify#5124)

@nflaig nflaig requested a review from a team as a code owner April 3, 2024 18:13
jeluard
jeluard previously approved these changes Apr 3, 2024
@@ -84,34 +84,34 @@ export class RestApiServer {
// Log all incoming request to debug (before parsing). TODO: Should we hook latter in the lifecycle? https://www.fastify.io/docs/latest/Lifecycle/
// Note: Must be an async method so fastify can continue the release lifecycle. Otherwise we must call done() or the request stalls
server.addHook("onRequest", async (req, _res) => {
const {operationId} = req.routeConfig as RouteConfig;
this.logger.debug(`Req ${req.id as string} ${req.ip} ${operationId}`);
const operationId = req.routeSchema.operationId as string;
Copy link
Member Author

Choose a reason for hiding this comment

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

It makes more sense to get this from schema as operationId is already part of standard type definition. We can drop including it in custom routeConfig altogether but will do that on the refactor branch

metrics?.responseTime.observe({operationId}, res.getResponseTime() / 1000);
const operationId = req.routeSchema.operationId as string;
this.logger.debug(`Res ${req.id} ${operationId} - ${res.raw.statusCode}`);
metrics?.responseTime.observe({operationId}, res.elapsedTime / 1000);
Copy link
Member Author

Choose a reason for hiding this comment

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

As of latest release getResponseTime() has been deprecated (fastify/fastify#5263) and will be removed in the next major release (v5)

@nflaig nflaig requested a review from jeluard April 3, 2024 21:22
Copy link

codecov bot commented Apr 3, 2024

Codecov Report

Merging #6626 (29d39bc) into unstable (3076b4c) will not change coverage.
The diff coverage is n/a.

Additional details and impacted files
@@            Coverage Diff            @@
##           unstable    #6626   +/-   ##
=========================================
  Coverage     61.70%   61.70%           
=========================================
  Files           556      556           
  Lines         58799    58799           
  Branches       1886     1886           
=========================================
  Hits          36283    36283           
  Misses        22475    22475           
  Partials         41       41           

Copy link
Contributor

github-actions bot commented Apr 3, 2024

Performance Report

✔️ no performance regression detected

🚀🚀 Significant benchmark improvement detected

Benchmark suite Current: 57a473f Previous: 3076b4c Ratio
Set add up to 128 items then delete first 4.1640 us/op 13.694 us/op 0.30
forkChoice updateHead vc 600000 bc 64 eq 300000 14.975 ms/op 58.632 ms/op 0.26
altair processAttestation - 250000 vs - 7PWei worstcase 2.5730 ms/op 7.8116 ms/op 0.33
altair processAttestation - setStatus - 1/6 committees join 91.845 us/op 293.36 us/op 0.31
altair processAttestation - setStatus - 1/3 committees join 158.50 us/op 598.30 us/op 0.26
altair processAttestation - setStatus - 1/2 committees join 257.30 us/op 829.02 us/op 0.31
altair processAttestation - setStatus - 2/3 committees join 288.02 us/op 1.1176 ms/op 0.26
altair processAttestation - setStatus - 4/5 committees join 429.80 us/op 1.5037 ms/op 0.29
Full benchmark results
Benchmark suite Current: 57a473f Previous: 3076b4c Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 1.0481 ms/op 1.5964 ms/op 0.66
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 85.204 us/op 197.59 us/op 0.43
BLS verify - blst-native 1.1224 ms/op 1.8002 ms/op 0.62
BLS verifyMultipleSignatures 3 - blst-native 2.3962 ms/op 3.9606 ms/op 0.61
BLS verifyMultipleSignatures 8 - blst-native 5.3685 ms/op 9.3440 ms/op 0.57
BLS verifyMultipleSignatures 32 - blst-native 19.647 ms/op 26.629 ms/op 0.74
BLS verifyMultipleSignatures 64 - blst-native 38.431 ms/op 52.253 ms/op 0.74
BLS verifyMultipleSignatures 128 - blst-native 84.197 ms/op 109.98 ms/op 0.77
BLS deserializing 10000 signatures 835.43 ms/op 1.0698 s/op 0.78
BLS deserializing 100000 signatures 8.4054 s/op 10.773 s/op 0.78
BLS verifyMultipleSignatures - same message - 3 - blst-native 1.2168 ms/op 1.4160 ms/op 0.86
BLS verifyMultipleSignatures - same message - 8 - blst-native 1.3998 ms/op 1.5568 ms/op 0.90
BLS verifyMultipleSignatures - same message - 32 - blst-native 2.6359 ms/op 3.2957 ms/op 0.80
BLS verifyMultipleSignatures - same message - 64 - blst-native 2.9678 ms/op 5.1673 ms/op 0.57
BLS verifyMultipleSignatures - same message - 128 - blst-native 6.9897 ms/op 6.0103 ms/op 1.16
BLS aggregatePubkeys 32 - blst-native 27.434 us/op 28.562 us/op 0.96
BLS aggregatePubkeys 128 - blst-native 90.363 us/op 117.12 us/op 0.77
notSeenSlots=1 numMissedVotes=1 numBadVotes=10 56.178 ms/op 85.282 ms/op 0.66
notSeenSlots=1 numMissedVotes=0 numBadVotes=4 54.212 ms/op 89.341 ms/op 0.61
notSeenSlots=2 numMissedVotes=1 numBadVotes=10 26.467 ms/op 44.155 ms/op 0.60
getSlashingsAndExits - default max 113.78 us/op 266.52 us/op 0.43
getSlashingsAndExits - 2k 298.61 us/op 595.59 us/op 0.50
proposeBlockBody type=full, size=empty 4.2447 ms/op 6.2703 ms/op 0.68
isKnown best case - 1 super set check 315.00 ns/op 799.00 ns/op 0.39
isKnown normal case - 2 super set checks 339.00 ns/op 776.00 ns/op 0.44
isKnown worse case - 16 super set checks 355.00 ns/op 734.00 ns/op 0.48
InMemoryCheckpointStateCache - add get delete 3.9690 us/op 8.3110 us/op 0.48
validate api signedAggregateAndProof - struct 2.3869 ms/op 3.1509 ms/op 0.76
validate gossip signedAggregateAndProof - struct 2.3717 ms/op 3.2212 ms/op 0.74
validate gossip attestation - vc 640000 1.1638 ms/op 1.5715 ms/op 0.74
batch validate gossip attestation - vc 640000 - chunk 32 142.17 us/op 199.99 us/op 0.71
batch validate gossip attestation - vc 640000 - chunk 64 129.95 us/op 172.20 us/op 0.75
batch validate gossip attestation - vc 640000 - chunk 128 118.76 us/op 184.53 us/op 0.64
batch validate gossip attestation - vc 640000 - chunk 256 110.87 us/op 173.70 us/op 0.64
pickEth1Vote - no votes 1.0121 ms/op 1.5663 ms/op 0.65
pickEth1Vote - max votes 6.7156 ms/op 15.390 ms/op 0.44
pickEth1Vote - Eth1Data hashTreeRoot value x2048 13.073 ms/op 29.282 ms/op 0.45
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 21.715 ms/op 39.167 ms/op 0.55
pickEth1Vote - Eth1Data fastSerialize value x2048 496.17 us/op 1.1080 ms/op 0.45
pickEth1Vote - Eth1Data fastSerialize tree x2048 3.4501 ms/op 10.201 ms/op 0.34
bytes32 toHexString 445.00 ns/op 1.2150 us/op 0.37
bytes32 Buffer.toString(hex) 340.00 ns/op 445.00 ns/op 0.76
bytes32 Buffer.toString(hex) from Uint8Array 459.00 ns/op 893.00 ns/op 0.51
bytes32 Buffer.toString(hex) + 0x 374.00 ns/op 493.00 ns/op 0.76
Object access 1 prop 0.21400 ns/op 0.34500 ns/op 0.62
Map access 1 prop 0.22200 ns/op 0.20000 ns/op 1.11
Object get x1000 5.7470 ns/op 10.033 ns/op 0.57
Map get x1000 0.83300 ns/op 1.2320 ns/op 0.68
Object set x1000 40.615 ns/op 107.66 ns/op 0.38
Map set x1000 30.756 ns/op 76.265 ns/op 0.40
Return object 10000 times 0.22740 ns/op 0.35250 ns/op 0.65
Throw Error 10000 times 2.7432 us/op 5.1491 us/op 0.53
fastMsgIdFn sha256 / 200 bytes 2.0570 us/op 4.9670 us/op 0.41
fastMsgIdFn h32 xxhash / 200 bytes 363.00 ns/op 549.00 ns/op 0.66
fastMsgIdFn h64 xxhash / 200 bytes 399.00 ns/op 569.00 ns/op 0.70
fastMsgIdFn sha256 / 1000 bytes 6.3180 us/op 14.652 us/op 0.43
fastMsgIdFn h32 xxhash / 1000 bytes 483.00 ns/op 736.00 ns/op 0.66
fastMsgIdFn h64 xxhash / 1000 bytes 462.00 ns/op 613.00 ns/op 0.75
fastMsgIdFn sha256 / 10000 bytes 52.707 us/op 128.62 us/op 0.41
fastMsgIdFn h32 xxhash / 10000 bytes 1.8770 us/op 2.5280 us/op 0.74
fastMsgIdFn h64 xxhash / 10000 bytes 1.2650 us/op 1.7430 us/op 0.73
send data - 1000 256B messages 15.184 ms/op 30.972 ms/op 0.49
send data - 1000 512B messages 18.380 ms/op 45.928 ms/op 0.40
send data - 1000 1024B messages 27.018 ms/op 55.913 ms/op 0.48
send data - 1000 1200B messages 35.092 ms/op 42.293 ms/op 0.83
send data - 1000 2048B messages 39.895 ms/op 75.152 ms/op 0.53
send data - 1000 4096B messages 44.916 ms/op 53.917 ms/op 0.83
send data - 1000 16384B messages 106.90 ms/op 188.96 ms/op 0.57
send data - 1000 65536B messages 449.05 ms/op 717.83 ms/op 0.63
enrSubnets - fastDeserialize 64 bits 1.1290 us/op 2.1630 us/op 0.52
enrSubnets - ssz BitVector 64 bits 546.00 ns/op 688.00 ns/op 0.79
enrSubnets - fastDeserialize 4 bits 285.00 ns/op 287.00 ns/op 0.99
enrSubnets - ssz BitVector 4 bits 614.00 ns/op 734.00 ns/op 0.84
prioritizePeers score -10:0 att 32-0.1 sync 2-0 95.729 us/op 145.67 us/op 0.66
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 107.12 us/op 217.75 us/op 0.49
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 151.68 us/op 300.02 us/op 0.51
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 262.89 us/op 457.11 us/op 0.58
prioritizePeers score 0:0 att 64-1 sync 4-1 248.45 us/op 504.40 us/op 0.49
array of 16000 items push then shift 1.4216 us/op 2.0823 us/op 0.68
LinkedList of 16000 items push then shift 6.9840 ns/op 14.427 ns/op 0.48
array of 16000 items push then pop 119.62 ns/op 158.24 ns/op 0.76
LinkedList of 16000 items push then pop 6.1510 ns/op 12.207 ns/op 0.50
array of 24000 items push then shift 2.0337 us/op 3.1369 us/op 0.65
LinkedList of 24000 items push then shift 6.1580 ns/op 14.806 ns/op 0.42
array of 24000 items push then pop 133.22 ns/op 226.43 ns/op 0.59
LinkedList of 24000 items push then pop 5.8610 ns/op 11.236 ns/op 0.52
intersect bitArray bitLen 8 4.9920 ns/op 7.2380 ns/op 0.69
intersect array and set length 8 53.308 ns/op 118.36 ns/op 0.45
intersect bitArray bitLen 128 30.009 ns/op 44.303 ns/op 0.68
intersect array and set length 128 778.56 ns/op 1.2956 us/op 0.60
bitArray.getTrueBitIndexes() bitLen 128 1.4480 us/op 2.2060 us/op 0.66
bitArray.getTrueBitIndexes() bitLen 248 2.1310 us/op 3.4330 us/op 0.62
bitArray.getTrueBitIndexes() bitLen 512 4.2470 us/op 7.7110 us/op 0.55
Buffer.concat 32 items 1.0750 us/op 1.2870 us/op 0.84
Uint8Array.set 32 items 1.9140 us/op 2.9720 us/op 0.64
Set add up to 64 items then delete first 2.2783 us/op 5.5472 us/op 0.41
OrderedSet add up to 64 items then delete first 3.5394 us/op 7.8960 us/op 0.45
Set add up to 64 items then delete last 2.7538 us/op 6.4196 us/op 0.43
OrderedSet add up to 64 items then delete last 3.6141 us/op 9.0800 us/op 0.40
Set add up to 64 items then delete middle 2.6003 us/op 6.4032 us/op 0.41
OrderedSet add up to 64 items then delete middle 4.5441 us/op 10.036 us/op 0.45
Set add up to 128 items then delete first 4.1640 us/op 13.694 us/op 0.30
OrderedSet add up to 128 items then delete first 7.8534 us/op 18.340 us/op 0.43
Set add up to 128 items then delete last 5.1381 us/op 12.701 us/op 0.40
OrderedSet add up to 128 items then delete last 6.7964 us/op 17.771 us/op 0.38
Set add up to 128 items then delete middle 4.8416 us/op 13.359 us/op 0.36
OrderedSet add up to 128 items then delete middle 12.749 us/op 22.418 us/op 0.57
Set add up to 256 items then delete first 10.265 us/op 25.924 us/op 0.40
OrderedSet add up to 256 items then delete first 15.268 us/op 36.222 us/op 0.42
Set add up to 256 items then delete last 10.190 us/op 24.566 us/op 0.41
OrderedSet add up to 256 items then delete last 16.502 us/op 35.699 us/op 0.46
Set add up to 256 items then delete middle 9.5326 us/op 23.236 us/op 0.41
OrderedSet add up to 256 items then delete middle 37.599 us/op 56.584 us/op 0.66
transfer serialized Status (84 B) 1.7980 us/op 2.5000 us/op 0.72
copy serialized Status (84 B) 1.3120 us/op 1.6490 us/op 0.80
transfer serialized SignedVoluntaryExit (112 B) 1.7430 us/op 2.2280 us/op 0.78
copy serialized SignedVoluntaryExit (112 B) 1.3200 us/op 1.6310 us/op 0.81
transfer serialized ProposerSlashing (416 B) 2.1360 us/op 2.5970 us/op 0.82
copy serialized ProposerSlashing (416 B) 1.7860 us/op 2.3160 us/op 0.77
transfer serialized Attestation (485 B) 2.3730 us/op 2.6780 us/op 0.89
copy serialized Attestation (485 B) 3.2740 us/op 2.3560 us/op 1.39
transfer serialized AttesterSlashing (33232 B) 1.7460 us/op 2.6460 us/op 0.66
copy serialized AttesterSlashing (33232 B) 5.2740 us/op 9.1290 us/op 0.58
transfer serialized Small SignedBeaconBlock (128000 B) 2.3090 us/op 2.6890 us/op 0.86
copy serialized Small SignedBeaconBlock (128000 B) 9.6660 us/op 24.787 us/op 0.39
transfer serialized Avg SignedBeaconBlock (200000 B) 2.0540 us/op 3.0400 us/op 0.68
copy serialized Avg SignedBeaconBlock (200000 B) 17.376 us/op 40.419 us/op 0.43
transfer serialized BlobsSidecar (524380 B) 3.3250 us/op 4.7620 us/op 0.70
copy serialized BlobsSidecar (524380 B) 117.39 us/op 171.85 us/op 0.68
transfer serialized Big SignedBeaconBlock (1000000 B) 4.4560 us/op 5.7590 us/op 0.77
copy serialized Big SignedBeaconBlock (1000000 B) 148.18 us/op 397.07 us/op 0.37
pass gossip attestations to forkchoice per slot 2.9110 ms/op 6.0880 ms/op 0.48
forkChoice updateHead vc 100000 bc 64 eq 0 448.10 us/op 794.03 us/op 0.56
forkChoice updateHead vc 600000 bc 64 eq 0 3.1762 ms/op 8.8672 ms/op 0.36
forkChoice updateHead vc 1000000 bc 64 eq 0 5.1485 ms/op 9.1095 ms/op 0.57
forkChoice updateHead vc 600000 bc 320 eq 0 2.8974 ms/op 5.7501 ms/op 0.50
forkChoice updateHead vc 600000 bc 1200 eq 0 3.0461 ms/op 6.1549 ms/op 0.49
forkChoice updateHead vc 600000 bc 7200 eq 0 3.6458 ms/op 7.9725 ms/op 0.46
forkChoice updateHead vc 600000 bc 64 eq 1000 10.182 ms/op 13.266 ms/op 0.77
forkChoice updateHead vc 600000 bc 64 eq 10000 10.563 ms/op 14.847 ms/op 0.71
forkChoice updateHead vc 600000 bc 64 eq 300000 14.975 ms/op 58.632 ms/op 0.26
computeDeltas 500000 validators 300 proto nodes 3.5681 ms/op 8.2394 ms/op 0.43
computeDeltas 500000 validators 1200 proto nodes 3.2580 ms/op 8.1906 ms/op 0.40
computeDeltas 500000 validators 7200 proto nodes 3.2060 ms/op 8.2046 ms/op 0.39
computeDeltas 750000 validators 300 proto nodes 5.2869 ms/op 11.033 ms/op 0.48
computeDeltas 750000 validators 1200 proto nodes 5.0467 ms/op 10.947 ms/op 0.46
computeDeltas 750000 validators 7200 proto nodes 4.9814 ms/op 12.764 ms/op 0.39
computeDeltas 1400000 validators 300 proto nodes 9.4480 ms/op 23.496 ms/op 0.40
computeDeltas 1400000 validators 1200 proto nodes 9.4589 ms/op 24.335 ms/op 0.39
computeDeltas 1400000 validators 7200 proto nodes 10.101 ms/op 25.061 ms/op 0.40
computeDeltas 2100000 validators 300 proto nodes 14.703 ms/op 37.005 ms/op 0.40
computeDeltas 2100000 validators 1200 proto nodes 14.049 ms/op 37.609 ms/op 0.37
computeDeltas 2100000 validators 7200 proto nodes 14.234 ms/op 37.309 ms/op 0.38
altair processAttestation - 250000 vs - 7PWei normalcase 2.0719 ms/op 4.5707 ms/op 0.45
altair processAttestation - 250000 vs - 7PWei worstcase 2.5730 ms/op 7.8116 ms/op 0.33
altair processAttestation - setStatus - 1/6 committees join 91.845 us/op 293.36 us/op 0.31
altair processAttestation - setStatus - 1/3 committees join 158.50 us/op 598.30 us/op 0.26
altair processAttestation - setStatus - 1/2 committees join 257.30 us/op 829.02 us/op 0.31
altair processAttestation - setStatus - 2/3 committees join 288.02 us/op 1.1176 ms/op 0.26
altair processAttestation - setStatus - 4/5 committees join 429.80 us/op 1.5037 ms/op 0.29
altair processAttestation - setStatus - 100% committees join 522.90 us/op 1.4426 ms/op 0.36
altair processBlock - 250000 vs - 7PWei normalcase 8.9462 ms/op 9.6972 ms/op 0.92
altair processBlock - 250000 vs - 7PWei normalcase hashState 44.173 ms/op 42.882 ms/op 1.03
altair processBlock - 250000 vs - 7PWei worstcase 39.653 ms/op 56.135 ms/op 0.71
altair processBlock - 250000 vs - 7PWei worstcase hashState 90.986 ms/op 132.87 ms/op 0.68
phase0 processBlock - 250000 vs - 7PWei normalcase 2.1060 ms/op 4.0496 ms/op 0.52
phase0 processBlock - 250000 vs - 7PWei worstcase 27.343 ms/op 39.807 ms/op 0.69
altair processEth1Data - 250000 vs - 7PWei normalcase 600.48 us/op 894.53 us/op 0.67
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 10.381 us/op 18.310 us/op 0.57
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 59.535 us/op 90.305 us/op 0.66
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 21.121 us/op 32.332 us/op 0.65
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 16.861 us/op 21.864 us/op 0.77
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 160.68 us/op 208.37 us/op 0.77
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 1.1296 ms/op 1.8067 ms/op 0.63
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 1.5345 ms/op 2.6445 ms/op 0.58
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 1.5487 ms/op 2.2609 ms/op 0.69
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 3.2675 ms/op 4.3819 ms/op 0.75
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 2.1796 ms/op 3.3772 ms/op 0.65
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 6.4036 ms/op 6.7675 ms/op 0.95
Tree 40 250000 create 459.36 ms/op 569.36 ms/op 0.81
Tree 40 250000 get(125000) 123.75 ns/op 229.09 ns/op 0.54
Tree 40 250000 set(125000) 914.87 ns/op 1.1105 us/op 0.82
Tree 40 250000 toArray() 24.403 ms/op 21.567 ms/op 1.13
Tree 40 250000 iterate all - toArray() + loop 23.125 ms/op 22.054 ms/op 1.05
Tree 40 250000 iterate all - get(i) 58.077 ms/op 77.567 ms/op 0.75
MutableVector 250000 create 13.974 ms/op 19.992 ms/op 0.70
MutableVector 250000 get(125000) 6.0140 ns/op 6.3390 ns/op 0.95
MutableVector 250000 set(125000) 232.19 ns/op 269.53 ns/op 0.86
MutableVector 250000 toArray() 3.3644 ms/op 3.1707 ms/op 1.06
MutableVector 250000 iterate all - toArray() + loop 4.5779 ms/op 3.7906 ms/op 1.21
MutableVector 250000 iterate all - get(i) 1.3637 ms/op 1.5991 ms/op 0.85
Array 250000 create 3.9570 ms/op 3.2739 ms/op 1.21
Array 250000 clone - spread 1.4001 ms/op 1.3379 ms/op 1.05
Array 250000 get(125000) 1.2130 ns/op 1.1110 ns/op 1.09
Array 250000 set(125000) 1.3740 ns/op 4.3990 ns/op 0.31
Array 250000 iterate all - loop 159.59 us/op 170.04 us/op 0.94
effectiveBalanceIncrements clone Uint8Array 300000 17.754 us/op 31.031 us/op 0.57
effectiveBalanceIncrements clone MutableVector 300000 464.00 ns/op 414.00 ns/op 1.12
effectiveBalanceIncrements rw all Uint8Array 300000 199.88 us/op 206.55 us/op 0.97
effectiveBalanceIncrements rw all MutableVector 300000 85.645 ms/op 92.738 ms/op 0.92
phase0 afterProcessEpoch - 250000 vs - 7PWei 81.792 ms/op 116.69 ms/op 0.70
phase0 beforeProcessEpoch - 250000 vs - 7PWei 48.080 ms/op 65.616 ms/op 0.73
altair processEpoch - mainnet_e81889 450.11 ms/op 592.63 ms/op 0.76
mainnet_e81889 - altair beforeProcessEpoch 80.567 ms/op 108.29 ms/op 0.74
mainnet_e81889 - altair processJustificationAndFinalization 15.588 us/op 32.817 us/op 0.47
mainnet_e81889 - altair processInactivityUpdates 4.7940 ms/op 8.3620 ms/op 0.57
mainnet_e81889 - altair processRewardsAndPenalties 75.789 ms/op 73.099 ms/op 1.04
mainnet_e81889 - altair processRegistryUpdates 3.6620 us/op 3.6940 us/op 0.99
mainnet_e81889 - altair processSlashings 672.00 ns/op 1.0910 us/op 0.62
mainnet_e81889 - altair processEth1DataReset 849.00 ns/op 609.00 ns/op 1.39
mainnet_e81889 - altair processEffectiveBalanceUpdates 1.0651 ms/op 1.3983 ms/op 0.76
mainnet_e81889 - altair processSlashingsReset 3.5200 us/op 5.7370 us/op 0.61
mainnet_e81889 - altair processRandaoMixesReset 6.6410 us/op 5.2520 us/op 1.26
mainnet_e81889 - altair processHistoricalRootsUpdate 1.0410 us/op 904.00 ns/op 1.15
mainnet_e81889 - altair processParticipationFlagUpdates 2.6120 us/op 1.9770 us/op 1.32
mainnet_e81889 - altair processSyncCommitteeUpdates 909.00 ns/op 756.00 ns/op 1.20
mainnet_e81889 - altair afterProcessEpoch 82.938 ms/op 123.72 ms/op 0.67
capella processEpoch - mainnet_e217614 1.9269 s/op 2.1142 s/op 0.91
mainnet_e217614 - capella beforeProcessEpoch 456.84 ms/op 525.44 ms/op 0.87
mainnet_e217614 - capella processJustificationAndFinalization 19.113 us/op 19.249 us/op 0.99
mainnet_e217614 - capella processInactivityUpdates 18.794 ms/op 20.051 ms/op 0.94
mainnet_e217614 - capella processRewardsAndPenalties 591.21 ms/op 601.43 ms/op 0.98
mainnet_e217614 - capella processRegistryUpdates 25.007 us/op 28.339 us/op 0.88
mainnet_e217614 - capella processSlashings 925.00 ns/op 832.00 ns/op 1.11
mainnet_e217614 - capella processEth1DataReset 874.00 ns/op 820.00 ns/op 1.07
mainnet_e217614 - capella processEffectiveBalanceUpdates 3.7758 ms/op 4.6446 ms/op 0.81
mainnet_e217614 - capella processSlashingsReset 5.3130 us/op 3.5810 us/op 1.48
mainnet_e217614 - capella processRandaoMixesReset 5.8560 us/op 5.8630 us/op 1.00
mainnet_e217614 - capella processHistoricalRootsUpdate 830.00 ns/op 1.0420 us/op 0.80
mainnet_e217614 - capella processParticipationFlagUpdates 2.2720 us/op 5.5780 us/op 0.41
mainnet_e217614 - capella afterProcessEpoch 217.72 ms/op 367.31 ms/op 0.59
phase0 processEpoch - mainnet_e58758 424.71 ms/op 478.08 ms/op 0.89
mainnet_e58758 - phase0 beforeProcessEpoch 127.92 ms/op 165.34 ms/op 0.77
mainnet_e58758 - phase0 processJustificationAndFinalization 20.739 us/op 16.903 us/op 1.23
mainnet_e58758 - phase0 processRewardsAndPenalties 56.760 ms/op 67.650 ms/op 0.84
mainnet_e58758 - phase0 processRegistryUpdates 16.379 us/op 13.867 us/op 1.18
mainnet_e58758 - phase0 processSlashings 1.1270 us/op 646.00 ns/op 1.74
mainnet_e58758 - phase0 processEth1DataReset 888.00 ns/op 659.00 ns/op 1.35
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 1.0857 ms/op 1.2184 ms/op 0.89
mainnet_e58758 - phase0 processSlashingsReset 5.3420 us/op 6.3130 us/op 0.85
mainnet_e58758 - phase0 processRandaoMixesReset 5.5120 us/op 7.9600 us/op 0.69
mainnet_e58758 - phase0 processHistoricalRootsUpdate 1.1070 us/op 1.3150 us/op 0.84
mainnet_e58758 - phase0 processParticipationRecordUpdates 5.5640 us/op 4.7580 us/op 1.17
mainnet_e58758 - phase0 afterProcessEpoch 74.658 ms/op 112.25 ms/op 0.67
phase0 processEffectiveBalanceUpdates - 250000 normalcase 1.0561 ms/op 1.9024 ms/op 0.56
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 1.2576 ms/op 1.8736 ms/op 0.67
altair processInactivityUpdates - 250000 normalcase 30.331 ms/op 30.273 ms/op 1.00
altair processInactivityUpdates - 250000 worstcase 26.595 ms/op 32.236 ms/op 0.82
phase0 processRegistryUpdates - 250000 normalcase 11.581 us/op 14.587 us/op 0.79
phase0 processRegistryUpdates - 250000 badcase_full_deposits 486.28 us/op 554.67 us/op 0.88
phase0 processRegistryUpdates - 250000 worstcase 0.5 142.18 ms/op 188.76 ms/op 0.75
altair processRewardsAndPenalties - 250000 normalcase 66.383 ms/op 68.318 ms/op 0.97
altair processRewardsAndPenalties - 250000 worstcase 68.562 ms/op 82.655 ms/op 0.83
phase0 getAttestationDeltas - 250000 normalcase 6.5938 ms/op 11.815 ms/op 0.56
phase0 getAttestationDeltas - 250000 worstcase 8.4873 ms/op 10.525 ms/op 0.81
phase0 processSlashings - 250000 worstcase 103.05 us/op 149.28 us/op 0.69
altair processSyncCommitteeUpdates - 250000 126.98 ms/op 182.99 ms/op 0.69
BeaconState.hashTreeRoot - No change 740.00 ns/op 777.00 ns/op 0.95
BeaconState.hashTreeRoot - 1 full validator 197.68 us/op 190.55 us/op 1.04
BeaconState.hashTreeRoot - 32 full validator 2.0346 ms/op 2.0344 ms/op 1.00
BeaconState.hashTreeRoot - 512 full validator 20.413 ms/op 22.134 ms/op 0.92
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 216.21 us/op 204.62 us/op 1.06
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 2.2924 ms/op 2.7877 ms/op 0.82
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 31.285 ms/op 39.056 ms/op 0.80
BeaconState.hashTreeRoot - 1 balances 107.56 us/op 168.75 us/op 0.64
BeaconState.hashTreeRoot - 32 balances 1.2047 ms/op 1.4749 ms/op 0.82
BeaconState.hashTreeRoot - 512 balances 13.374 ms/op 15.710 ms/op 0.85
BeaconState.hashTreeRoot - 250000 balances 213.08 ms/op 248.77 ms/op 0.86
aggregationBits - 2048 els - zipIndexesInBitList 23.239 us/op 46.199 us/op 0.50
byteArrayEquals 32 65.075 ns/op 80.321 ns/op 0.81
Buffer.compare 32 38.112 ns/op 58.867 ns/op 0.65
byteArrayEquals 1024 1.7743 us/op 2.1306 us/op 0.83
Buffer.compare 1024 47.020 ns/op 81.743 ns/op 0.58
byteArrayEquals 16384 30.557 us/op 34.139 us/op 0.90
Buffer.compare 16384 234.84 ns/op 275.24 ns/op 0.85
byteArrayEquals 123687377 226.34 ms/op 284.94 ms/op 0.79
Buffer.compare 123687377 10.250 ms/op 24.858 ms/op 0.41
byteArrayEquals 32 - diff last byte 71.462 ns/op 91.729 ns/op 0.78
Buffer.compare 32 - diff last byte 38.629 ns/op 63.453 ns/op 0.61
byteArrayEquals 1024 - diff last byte 1.8033 us/op 2.2074 us/op 0.82
Buffer.compare 1024 - diff last byte 48.204 ns/op 87.134 ns/op 0.55
byteArrayEquals 16384 - diff last byte 30.785 us/op 36.076 us/op 0.85
Buffer.compare 16384 - diff last byte 250.46 ns/op 304.59 ns/op 0.82
byteArrayEquals 123687377 - diff last byte 219.38 ms/op 288.85 ms/op 0.76
Buffer.compare 123687377 - diff last byte 7.5472 ms/op 10.332 ms/op 0.73
byteArrayEquals 32 - random bytes 5.7190 ns/op 6.6910 ns/op 0.85
Buffer.compare 32 - random bytes 41.408 ns/op 69.811 ns/op 0.59
byteArrayEquals 1024 - random bytes 4.7240 ns/op 6.8220 ns/op 0.69
Buffer.compare 1024 - random bytes 39.935 ns/op 69.315 ns/op 0.58
byteArrayEquals 16384 - random bytes 4.8670 ns/op 6.9130 ns/op 0.70
Buffer.compare 16384 - random bytes 39.957 ns/op 68.909 ns/op 0.58
byteArrayEquals 123687377 - random bytes 8.2900 ns/op 10.940 ns/op 0.76
Buffer.compare 123687377 - random bytes 49.120 ns/op 81.670 ns/op 0.60
regular array get 100000 times 43.577 us/op 49.331 us/op 0.88
wrappedArray get 100000 times 43.133 us/op 48.415 us/op 0.89
arrayWithProxy get 100000 times 10.364 ms/op 16.597 ms/op 0.62
ssz.Root.equals 56.050 ns/op 62.532 ns/op 0.90
byteArrayEquals 55.395 ns/op 56.767 ns/op 0.98
Buffer.compare 10.341 ns/op 12.628 ns/op 0.82
shuffle list - 16384 els 5.9631 ms/op 9.2399 ms/op 0.65
shuffle list - 250000 els 92.066 ms/op 136.39 ms/op 0.68
processSlot - 1 slots 19.111 us/op 20.055 us/op 0.95
processSlot - 32 slots 3.1931 ms/op 4.8191 ms/op 0.66
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 56.941 ms/op 66.495 ms/op 0.86
getCommitteeAssignments - req 1 vs - 250000 vc 2.6381 ms/op 2.8259 ms/op 0.93
getCommitteeAssignments - req 100 vs - 250000 vc 3.6467 ms/op 4.0291 ms/op 0.91
getCommitteeAssignments - req 1000 vs - 250000 vc 4.2013 ms/op 4.3413 ms/op 0.97
findModifiedValidators - 10000 modified validators 352.06 ms/op 418.54 ms/op 0.84
findModifiedValidators - 1000 modified validators 212.32 ms/op 212.59 ms/op 1.00
findModifiedValidators - 100 modified validators 192.82 ms/op 216.92 ms/op 0.89
findModifiedValidators - 10 modified validators 213.75 ms/op 222.51 ms/op 0.96
findModifiedValidators - 1 modified validators 193.95 ms/op 240.68 ms/op 0.81
findModifiedValidators - no difference 272.43 ms/op 239.84 ms/op 1.14
compare ViewDUs 5.1916 s/op 5.4026 s/op 0.96
compare each validator Uint8Array 1.9408 s/op 1.7133 s/op 1.13
compare ViewDU to Uint8Array 1.3064 s/op 1.5133 s/op 0.86
migrate state 1000000 validators, 24 modified, 0 new 760.37 ms/op 965.64 ms/op 0.79
migrate state 1000000 validators, 1700 modified, 1000 new 965.02 ms/op 1.2731 s/op 0.76
migrate state 1000000 validators, 3400 modified, 2000 new 1.3221 s/op 1.7555 s/op 0.75
migrate state 1500000 validators, 24 modified, 0 new 692.32 ms/op 1.1304 s/op 0.61
migrate state 1500000 validators, 1700 modified, 1000 new 1.0063 s/op 1.2751 s/op 0.79
migrate state 1500000 validators, 3400 modified, 2000 new 1.3148 s/op 1.4054 s/op 0.94
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 5.1200 ns/op 5.1100 ns/op 1.00
state getBlockRootAtSlot - 250000 vs - 7PWei 831.04 ns/op 611.72 ns/op 1.36
computeProposers - vc 250000 7.0705 ms/op 9.6529 ms/op 0.73
computeEpochShuffling - vc 250000 90.395 ms/op 131.19 ms/op 0.69
getNextSyncCommittee - vc 250000 114.78 ms/op 162.48 ms/op 0.71
computeSigningRoot for AttestationData 22.414 us/op 25.497 us/op 0.88
hash AttestationData serialized data then Buffer.toString(base64) 1.3102 us/op 2.4574 us/op 0.53
toHexString serialized data 835.98 ns/op 1.1835 us/op 0.71
Buffer.toString(base64) 164.93 ns/op 264.32 ns/op 0.62

by benchmarkbot/action

jeluard
jeluard previously approved these changes Apr 4, 2024
Copy link
Contributor

@jeluard jeluard left a comment

Choose a reason for hiding this comment

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

Would be interesting to see what would be the impact of removing the extra Buffer.from.

Also worth noting that although cli depends on fastify (for test), it's not declared in their package.json.

@nflaig
Copy link
Member Author

nflaig commented Apr 4, 2024

Also worth noting that although clidependes on fastify (for test), it's not declared in their package.json.

Good catch! I think this PR is a good place to fix this, also updated for light-client package which uses fastify in tests as well

Would be interesting to see what would be the impact of removing the extra Buffer.from.

Will do some testing, haven't looked at actual performance difference yet

@nflaig nflaig merged commit 2ee8ac6 into unstable Apr 4, 2024
20 checks passed
@nflaig nflaig deleted the nflaig/update-fastify branch April 4, 2024 15:49
@wemeetagain
Copy link
Member

🎉 This PR is included in v1.18.0 🎉

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.

3 participants