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

fix: reduce getSingleTrueBit() calls #7209

Closed
wants to merge 2 commits into from
Closed

Conversation

twoeths
Copy link
Contributor

@twoeths twoeths commented Oct 30, 2024

Motivation

  • getSingleTrueBit() is called during attestation validation and in opPool while it is not simple:
getSingleTrueBit(): number | null {
    let index: number | null = null;

    const bytes = this.uint8Array;

    // Iterate over each byte of bits
    for (let iByte = 0, byteLen = bytes.length; iByte < byteLen; iByte++) {
      // If it's exactly zero, there won't be any indexes, continue early
      if (bytes[iByte] === 0) {
        continue;
      }

      // Get the precomputed boolean array for this byte
      const booleansInByte = getUint8ByteToBitBooleanArray(bytes[iByte]);
      // For each bit in the byte check participation and add to indexesSelected array
      for (let iBit = 0; iBit < 8; iBit++) {
        if (booleansInByte[iBit] === true) {
          if (index !== null) {
            // ERROR_MORE_THAN_ONE_BIT_SET
            return null;
          }

          index = iByte * 8 + iBit;
        }
      }
    }

    if (index === null) {
      // ERROR_NO_BIT_SET
      return null;
    } else {
      return index;
    }
  }

Description

  • cache participationIndex as a result of attestation validation, so we don't have to extract it inside opPool

found when investigating #7206

Copy link

codecov bot commented Oct 30, 2024

Codecov Report

Attention: Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.

Project coverage is 48.91%. Comparing base (558ec2f) to head (1ea5f0f).
Report is 48 commits behind head on unstable.

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #7209      +/-   ##
============================================
- Coverage     49.21%   48.91%   -0.30%     
============================================
  Files           598      601       +3     
  Lines         39803    40183     +380     
  Branches       2102     2060      -42     
============================================
+ Hits          19588    19655      +67     
- Misses        20175    20490     +315     
+ Partials         40       38       -2     

Copy link
Contributor

github-actions bot commented Oct 30, 2024

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: f8a2cee Previous: b5fb76c Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 1.6160 ms/op 1.9312 ms/op 0.84
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 47.071 us/op 50.117 us/op 0.94
BLS verify - blst 884.85 us/op 983.24 us/op 0.90
BLS verifyMultipleSignatures 3 - blst 1.3812 ms/op 1.6833 ms/op 0.82
BLS verifyMultipleSignatures 8 - blst 1.5079 ms/op 1.9954 ms/op 0.76
BLS verifyMultipleSignatures 32 - blst 4.4808 ms/op 6.4291 ms/op 0.70
BLS verifyMultipleSignatures 64 - blst 8.4230 ms/op 11.213 ms/op 0.75
BLS verifyMultipleSignatures 128 - blst 16.108 ms/op 17.901 ms/op 0.90
BLS deserializing 10000 signatures 640.73 ms/op 713.02 ms/op 0.90
BLS deserializing 100000 signatures 6.2782 s/op 7.1966 s/op 0.87
BLS verifyMultipleSignatures - same message - 3 - blst 932.43 us/op 1.0445 ms/op 0.89
BLS verifyMultipleSignatures - same message - 8 - blst 1.0500 ms/op 1.1363 ms/op 0.92
BLS verifyMultipleSignatures - same message - 32 - blst 1.6648 ms/op 1.7984 ms/op 0.93
BLS verifyMultipleSignatures - same message - 64 - blst 2.5171 ms/op 2.8785 ms/op 0.87
BLS verifyMultipleSignatures - same message - 128 - blst 4.1343 ms/op 4.5639 ms/op 0.91
BLS aggregatePubkeys 32 - blst 18.012 us/op 21.660 us/op 0.83
BLS aggregatePubkeys 128 - blst 62.682 us/op 74.848 us/op 0.84
notSeenSlots=1 numMissedVotes=1 numBadVotes=10 59.255 ms/op 108.24 ms/op 0.55
notSeenSlots=1 numMissedVotes=0 numBadVotes=4 62.694 ms/op 62.701 ms/op 1.00
notSeenSlots=2 numMissedVotes=1 numBadVotes=10 44.478 ms/op 52.538 ms/op 0.85
getSlashingsAndExits - default max 177.72 us/op 150.87 us/op 1.18
getSlashingsAndExits - 2k 468.72 us/op 563.77 us/op 0.83
proposeBlockBody type=full, size=empty 4.9723 ms/op 6.9553 ms/op 0.71
isKnown best case - 1 super set check 441.00 ns/op 414.00 ns/op 1.07
isKnown normal case - 2 super set checks 438.00 ns/op 451.00 ns/op 0.97
isKnown worse case - 16 super set checks 430.00 ns/op 455.00 ns/op 0.95
InMemoryCheckpointStateCache - add get delete 2.5410 us/op 3.3550 us/op 0.76
validate api signedAggregateAndProof - struct 1.9612 ms/op 1.6190 ms/op 1.21
validate gossip signedAggregateAndProof - struct 1.9097 ms/op 1.6761 ms/op 1.14
batch validate gossip attestation - vc 640000 - chunk 32 125.12 us/op 156.72 us/op 0.80
batch validate gossip attestation - vc 640000 - chunk 64 113.34 us/op 146.94 us/op 0.77
batch validate gossip attestation - vc 640000 - chunk 128 96.014 us/op 124.36 us/op 0.77
batch validate gossip attestation - vc 640000 - chunk 256 94.909 us/op 124.23 us/op 0.76
pickEth1Vote - no votes 870.45 us/op 1.1410 ms/op 0.76
pickEth1Vote - max votes 5.0447 ms/op 6.1047 ms/op 0.83
pickEth1Vote - Eth1Data hashTreeRoot value x2048 14.162 ms/op 13.278 ms/op 1.07
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 20.065 ms/op 26.334 ms/op 0.76
pickEth1Vote - Eth1Data fastSerialize value x2048 387.49 us/op 594.94 us/op 0.65
pickEth1Vote - Eth1Data fastSerialize tree x2048 3.1273 ms/op 4.7901 ms/op 0.65
bytes32 toHexString 603.00 ns/op 601.00 ns/op 1.00
bytes32 Buffer.toString(hex) 428.00 ns/op 243.00 ns/op 1.76
bytes32 Buffer.toString(hex) from Uint8Array 515.00 ns/op 453.00 ns/op 1.14
bytes32 Buffer.toString(hex) + 0x 430.00 ns/op 252.00 ns/op 1.71
Object access 1 prop 0.32400 ns/op 0.18200 ns/op 1.78
Map access 1 prop 0.31500 ns/op 0.14600 ns/op 2.16
Object get x1000 5.0570 ns/op 6.1910 ns/op 0.82
Map get x1000 5.9050 ns/op 6.8790 ns/op 0.86
Object set x1000 24.888 ns/op 51.666 ns/op 0.48
Map set x1000 19.113 ns/op 37.165 ns/op 0.51
Return object 10000 times 0.29290 ns/op 0.31480 ns/op 0.93
Throw Error 10000 times 2.6421 us/op 3.6703 us/op 0.72
toHex 109.98 ns/op 167.38 ns/op 0.66
Buffer.from 102.92 ns/op 156.05 ns/op 0.66
shared Buffer 70.035 ns/op 101.40 ns/op 0.69
fastMsgIdFn sha256 / 200 bytes 1.9580 us/op 2.5160 us/op 0.78
fastMsgIdFn h32 xxhash / 200 bytes 392.00 ns/op 315.00 ns/op 1.24
fastMsgIdFn h64 xxhash / 200 bytes 440.00 ns/op 315.00 ns/op 1.40
fastMsgIdFn sha256 / 1000 bytes 5.8940 us/op 7.8550 us/op 0.75
fastMsgIdFn h32 xxhash / 1000 bytes 513.00 ns/op 442.00 ns/op 1.16
fastMsgIdFn h64 xxhash / 1000 bytes 508.00 ns/op 379.00 ns/op 1.34
fastMsgIdFn sha256 / 10000 bytes 49.300 us/op 66.147 us/op 0.75
fastMsgIdFn h32 xxhash / 10000 bytes 1.8730 us/op 1.9820 us/op 0.95
fastMsgIdFn h64 xxhash / 10000 bytes 1.3150 us/op 1.3010 us/op 1.01
send data - 1000 256B messages 10.650 ms/op 14.029 ms/op 0.76
send data - 1000 512B messages 12.338 ms/op 18.425 ms/op 0.67
send data - 1000 1024B messages 21.783 ms/op 29.796 ms/op 0.73
send data - 1000 1200B messages 22.697 ms/op 26.579 ms/op 0.85
send data - 1000 2048B messages 28.573 ms/op 34.994 ms/op 0.82
send data - 1000 4096B messages 22.687 ms/op 32.319 ms/op 0.70
send data - 1000 16384B messages 64.476 ms/op 75.384 ms/op 0.86
send data - 1000 65536B messages 246.35 ms/op 239.27 ms/op 1.03
enrSubnets - fastDeserialize 64 bits 1.1320 us/op 1.1550 us/op 0.98
enrSubnets - ssz BitVector 64 bits 520.00 ns/op 405.00 ns/op 1.28
enrSubnets - fastDeserialize 4 bits 307.00 ns/op 192.00 ns/op 1.60
enrSubnets - ssz BitVector 4 bits 511.00 ns/op 450.00 ns/op 1.14
prioritizePeers score -10:0 att 32-0.1 sync 2-0 106.90 us/op 188.24 us/op 0.57
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 130.08 us/op 214.44 us/op 0.61
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 187.08 us/op 328.36 us/op 0.57
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 332.41 us/op 490.22 us/op 0.68
prioritizePeers score 0:0 att 64-1 sync 4-1 403.14 us/op 672.14 us/op 0.60
array of 16000 items push then shift 1.2057 us/op 1.7033 us/op 0.71
LinkedList of 16000 items push then shift 6.9350 ns/op 8.7420 ns/op 0.79
array of 16000 items push then pop 84.736 ns/op 140.65 ns/op 0.60
LinkedList of 16000 items push then pop 6.0130 ns/op 7.9340 ns/op 0.76
array of 24000 items push then shift 1.7539 us/op 2.4828 us/op 0.71
LinkedList of 24000 items push then shift 6.6960 ns/op 8.8330 ns/op 0.76
array of 24000 items push then pop 108.47 ns/op 164.64 ns/op 0.66
LinkedList of 24000 items push then pop 6.2940 ns/op 7.4090 ns/op 0.85
intersect bitArray bitLen 8 5.4230 ns/op 6.6620 ns/op 0.81
intersect array and set length 8 36.929 ns/op 46.657 ns/op 0.79
intersect bitArray bitLen 128 26.546 ns/op 31.228 ns/op 0.85
intersect array and set length 128 564.73 ns/op 691.96 ns/op 0.82
bitArray.getTrueBitIndexes() bitLen 128 1.3810 us/op 1.6090 us/op 0.86
bitArray.getTrueBitIndexes() bitLen 248 2.1310 us/op 2.5150 us/op 0.85
bitArray.getTrueBitIndexes() bitLen 512 3.7140 us/op 4.7850 us/op 0.78
Buffer.concat 32 items 894.00 ns/op 776.00 ns/op 1.15
Uint8Array.set 32 items 1.7390 us/op 1.4410 us/op 1.21
Buffer.copy 2.6150 us/op 2.6630 us/op 0.98
Uint8Array.set - with subarray 2.3440 us/op 2.2870 us/op 1.02
Uint8Array.set - without subarray 1.6820 us/op 1.4200 us/op 1.18
getUint32 - dataview 382.00 ns/op 233.00 ns/op 1.64
getUint32 - manual 323.00 ns/op 170.00 ns/op 1.90
Set add up to 64 items then delete first 1.7479 us/op 2.2593 us/op 0.77
OrderedSet add up to 64 items then delete first 2.6993 us/op 3.3249 us/op 0.81
Set add up to 64 items then delete last 2.0376 us/op 2.5328 us/op 0.80
OrderedSet add up to 64 items then delete last 2.9971 us/op 3.7826 us/op 0.79
Set add up to 64 items then delete middle 2.0028 us/op 2.5659 us/op 0.78
OrderedSet add up to 64 items then delete middle 4.9753 us/op 5.2497 us/op 0.95
Set add up to 128 items then delete first 3.9475 us/op 5.3500 us/op 0.74
OrderedSet add up to 128 items then delete first 6.1518 us/op 7.9665 us/op 0.77
Set add up to 128 items then delete last 3.8577 us/op 5.4551 us/op 0.71
OrderedSet add up to 128 items then delete last 5.5492 us/op 7.4776 us/op 0.74
Set add up to 128 items then delete middle 3.6145 us/op 5.3540 us/op 0.68
OrderedSet add up to 128 items then delete middle 11.207 us/op 15.682 us/op 0.71
Set add up to 256 items then delete first 7.4011 us/op 11.320 us/op 0.65
OrderedSet add up to 256 items then delete first 11.797 us/op 19.521 us/op 0.60
Set add up to 256 items then delete last 7.1724 us/op 12.036 us/op 0.60
OrderedSet add up to 256 items then delete last 11.084 us/op 18.509 us/op 0.60
Set add up to 256 items then delete middle 7.1232 us/op 11.724 us/op 0.61
OrderedSet add up to 256 items then delete middle 32.754 us/op 46.619 us/op 0.70
transfer serialized Status (84 B) 2.1840 us/op 2.8530 us/op 0.77
copy serialized Status (84 B) 1.3610 us/op 1.5070 us/op 0.90
transfer serialized SignedVoluntaryExit (112 B) 2.2840 us/op 2.9330 us/op 0.78
copy serialized SignedVoluntaryExit (112 B) 1.4270 us/op 1.4680 us/op 0.97
transfer serialized ProposerSlashing (416 B) 2.6580 us/op 3.1560 us/op 0.84
copy serialized ProposerSlashing (416 B) 1.9190 us/op 1.9010 us/op 1.01
transfer serialized Attestation (485 B) 2.5030 us/op 3.0880 us/op 0.81
copy serialized Attestation (485 B) 1.7700 us/op 1.8640 us/op 0.95
transfer serialized AttesterSlashing (33232 B) 2.7000 us/op 2.7640 us/op 0.98
copy serialized AttesterSlashing (33232 B) 5.2440 us/op 6.3920 us/op 0.82
transfer serialized Small SignedBeaconBlock (128000 B) 2.9390 us/op 3.6630 us/op 0.80
copy serialized Small SignedBeaconBlock (128000 B) 14.459 us/op 20.229 us/op 0.71
transfer serialized Avg SignedBeaconBlock (200000 B) 3.0620 us/op 4.5660 us/op 0.67
copy serialized Avg SignedBeaconBlock (200000 B) 18.064 us/op 27.684 us/op 0.65
transfer serialized BlobsSidecar (524380 B) 2.9780 us/op 4.7600 us/op 0.63
copy serialized BlobsSidecar (524380 B) 114.03 us/op 92.429 us/op 1.23
transfer serialized Big SignedBeaconBlock (1000000 B) 3.7390 us/op 5.3240 us/op 0.70
copy serialized Big SignedBeaconBlock (1000000 B) 157.26 us/op 396.50 us/op 0.40
pass gossip attestations to forkchoice per slot 2.3206 ms/op 2.9228 ms/op 0.79
forkChoice updateHead vc 100000 bc 64 eq 0 336.10 us/op 473.46 us/op 0.71
forkChoice updateHead vc 600000 bc 64 eq 0 2.2057 ms/op 3.1543 ms/op 0.70
forkChoice updateHead vc 1000000 bc 64 eq 0 3.6788 ms/op 5.1736 ms/op 0.71
forkChoice updateHead vc 600000 bc 320 eq 0 2.2265 ms/op 3.0562 ms/op 0.73
forkChoice updateHead vc 600000 bc 1200 eq 0 2.3055 ms/op 2.9986 ms/op 0.77
forkChoice updateHead vc 600000 bc 7200 eq 0 2.6845 ms/op 3.8554 ms/op 0.70
forkChoice updateHead vc 600000 bc 64 eq 1000 8.9663 ms/op 10.649 ms/op 0.84
forkChoice updateHead vc 600000 bc 64 eq 10000 8.8700 ms/op 10.644 ms/op 0.83
forkChoice updateHead vc 600000 bc 64 eq 300000 11.185 ms/op 15.971 ms/op 0.70
computeDeltas 500000 validators 300 proto nodes 3.1294 ms/op 4.2893 ms/op 0.73
computeDeltas 500000 validators 1200 proto nodes 3.1878 ms/op 4.1697 ms/op 0.76
computeDeltas 500000 validators 7200 proto nodes 3.0601 ms/op 4.1352 ms/op 0.74
computeDeltas 750000 validators 300 proto nodes 4.8957 ms/op 6.3695 ms/op 0.77
computeDeltas 750000 validators 1200 proto nodes 4.8845 ms/op 6.2209 ms/op 0.79
computeDeltas 750000 validators 7200 proto nodes 4.8725 ms/op 6.4931 ms/op 0.75
computeDeltas 1400000 validators 300 proto nodes 9.1337 ms/op 11.953 ms/op 0.76
computeDeltas 1400000 validators 1200 proto nodes 8.8064 ms/op 11.759 ms/op 0.75
computeDeltas 1400000 validators 7200 proto nodes 9.1917 ms/op 11.898 ms/op 0.77
computeDeltas 2100000 validators 300 proto nodes 13.749 ms/op 18.269 ms/op 0.75
computeDeltas 2100000 validators 1200 proto nodes 13.995 ms/op 18.629 ms/op 0.75
computeDeltas 2100000 validators 7200 proto nodes 13.758 ms/op 17.742 ms/op 0.78
altair processAttestation - 250000 vs - 7PWei normalcase 1.5527 ms/op 2.1543 ms/op 0.72
altair processAttestation - 250000 vs - 7PWei worstcase 2.2443 ms/op 3.5250 ms/op 0.64
altair processAttestation - setStatus - 1/6 committees join 91.494 us/op 140.13 us/op 0.65
altair processAttestation - setStatus - 1/3 committees join 178.86 us/op 244.36 us/op 0.73
altair processAttestation - setStatus - 1/2 committees join 267.10 us/op 332.28 us/op 0.80
altair processAttestation - setStatus - 2/3 committees join 358.81 us/op 455.09 us/op 0.79
altair processAttestation - setStatus - 4/5 committees join 479.48 us/op 612.13 us/op 0.78
altair processAttestation - setStatus - 100% committees join 577.23 us/op 743.21 us/op 0.78
altair processBlock - 250000 vs - 7PWei normalcase 5.0835 ms/op 4.9100 ms/op 1.04
altair processBlock - 250000 vs - 7PWei normalcase hashState 21.079 ms/op 31.975 ms/op 0.66
altair processBlock - 250000 vs - 7PWei worstcase 29.347 ms/op 42.483 ms/op 0.69
altair processBlock - 250000 vs - 7PWei worstcase hashState 66.252 ms/op 78.945 ms/op 0.84
phase0 processBlock - 250000 vs - 7PWei normalcase 1.5960 ms/op 2.8450 ms/op 0.56
phase0 processBlock - 250000 vs - 7PWei worstcase 24.996 ms/op 29.773 ms/op 0.84
altair processEth1Data - 250000 vs - 7PWei normalcase 270.73 us/op 329.65 us/op 0.82
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 8.0120 us/op 9.3670 us/op 0.86
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 46.989 us/op 72.768 us/op 0.65
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 8.2410 us/op 19.032 us/op 0.43
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 7.1900 us/op 10.249 us/op 0.70
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 180.16 us/op 224.53 us/op 0.80
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 951.44 us/op 1.2349 ms/op 0.77
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 1.3583 ms/op 2.3140 ms/op 0.59
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 1.2136 ms/op 1.8216 ms/op 0.67
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 3.0441 ms/op 5.1659 ms/op 0.59
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 1.1275 ms/op 2.0149 ms/op 0.56
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 2.8513 ms/op 4.7926 ms/op 0.59
Tree 40 250000 create 190.37 ms/op 253.23 ms/op 0.75
Tree 40 250000 get(125000) 118.66 ns/op 162.43 ns/op 0.73
Tree 40 250000 set(125000) 546.13 ns/op 741.34 ns/op 0.74
Tree 40 250000 toArray() 14.774 ms/op 21.468 ms/op 0.69
Tree 40 250000 iterate all - toArray() + loop 14.133 ms/op 21.387 ms/op 0.66
Tree 40 250000 iterate all - get(i) 41.574 ms/op 59.088 ms/op 0.70
Array 250000 create 3.1613 ms/op 3.9176 ms/op 0.81
Array 250000 clone - spread 1.2388 ms/op 1.6164 ms/op 0.77
Array 250000 get(125000) 0.56000 ns/op 0.47500 ns/op 1.18
Array 250000 set(125000) 0.58700 ns/op 0.51400 ns/op 1.14
Array 250000 iterate all - loop 77.351 us/op 94.157 us/op 0.82
phase0 afterProcessEpoch - 250000 vs - 7PWei 41.806 ms/op 57.027 ms/op 0.73
Array.fill - length 1000000 2.6004 ms/op 5.5505 ms/op 0.47
Array push - length 1000000 14.579 ms/op 21.109 ms/op 0.69
Array.get 0.27116 ns/op 0.29776 ns/op 0.91
Uint8Array.get 0.34685 ns/op 0.47685 ns/op 0.73
phase0 beforeProcessEpoch - 250000 vs - 7PWei 20.064 ms/op 20.567 ms/op 0.98
altair processEpoch - mainnet_e81889 281.59 ms/op 317.86 ms/op 0.89
mainnet_e81889 - altair beforeProcessEpoch 19.332 ms/op 21.073 ms/op 0.92
mainnet_e81889 - altair processJustificationAndFinalization 13.792 us/op 17.781 us/op 0.78
mainnet_e81889 - altair processInactivityUpdates 5.2432 ms/op 7.1549 ms/op 0.73
mainnet_e81889 - altair processRewardsAndPenalties 43.009 ms/op 44.795 ms/op 0.96
mainnet_e81889 - altair processRegistryUpdates 1.3720 us/op 5.2460 us/op 0.26
mainnet_e81889 - altair processSlashings 452.00 ns/op 594.00 ns/op 0.76
mainnet_e81889 - altair processEth1DataReset 500.00 ns/op 555.00 ns/op 0.90
mainnet_e81889 - altair processEffectiveBalanceUpdates 973.48 us/op 1.7784 ms/op 0.55
mainnet_e81889 - altair processSlashingsReset 1.7810 us/op 8.3160 us/op 0.21
mainnet_e81889 - altair processRandaoMixesReset 4.0360 us/op 7.8260 us/op 0.52
mainnet_e81889 - altair processHistoricalRootsUpdate 1.0120 us/op 895.00 ns/op 1.13
mainnet_e81889 - altair processParticipationFlagUpdates 1.7850 us/op 3.2410 us/op 0.55
mainnet_e81889 - altair processSyncCommitteeUpdates 804.00 ns/op 1.3310 us/op 0.60
mainnet_e81889 - altair afterProcessEpoch 44.355 ms/op 52.158 ms/op 0.85
capella processEpoch - mainnet_e217614 1.0349 s/op 1.2015 s/op 0.86
mainnet_e217614 - capella beforeProcessEpoch 69.940 ms/op 85.113 ms/op 0.82
mainnet_e217614 - capella processJustificationAndFinalization 13.829 us/op 17.889 us/op 0.77
mainnet_e217614 - capella processInactivityUpdates 12.731 ms/op 19.372 ms/op 0.66
mainnet_e217614 - capella processRewardsAndPenalties 214.60 ms/op 237.64 ms/op 0.90
mainnet_e217614 - capella processRegistryUpdates 15.237 us/op 19.840 us/op 0.77
mainnet_e217614 - capella processSlashings 872.00 ns/op 727.00 ns/op 1.20
mainnet_e217614 - capella processEth1DataReset 1.2010 us/op 1.4760 us/op 0.81
mainnet_e217614 - capella processEffectiveBalanceUpdates 3.8546 ms/op 17.574 ms/op 0.22
mainnet_e217614 - capella processSlashingsReset 4.3460 us/op 6.0130 us/op 0.72
mainnet_e217614 - capella processRandaoMixesReset 4.9470 us/op 6.6620 us/op 0.74
mainnet_e217614 - capella processHistoricalRootsUpdate 884.00 ns/op 782.00 ns/op 1.13
mainnet_e217614 - capella processParticipationFlagUpdates 3.6140 us/op 2.7930 us/op 1.29
mainnet_e217614 - capella afterProcessEpoch 103.59 ms/op 127.13 ms/op 0.81
phase0 processEpoch - mainnet_e58758 289.47 ms/op 337.48 ms/op 0.86
mainnet_e58758 - phase0 beforeProcessEpoch 70.102 ms/op 96.191 ms/op 0.73
mainnet_e58758 - phase0 processJustificationAndFinalization 11.993 us/op 17.203 us/op 0.70
mainnet_e58758 - phase0 processRewardsAndPenalties 27.162 ms/op 27.590 ms/op 0.98
mainnet_e58758 - phase0 processRegistryUpdates 7.6090 us/op 14.619 us/op 0.52
mainnet_e58758 - phase0 processSlashings 891.00 ns/op 652.00 ns/op 1.37
mainnet_e58758 - phase0 processEth1DataReset 926.00 ns/op 512.00 ns/op 1.81
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 924.97 us/op 1.4284 ms/op 0.65
mainnet_e58758 - phase0 processSlashingsReset 3.5500 us/op 2.7580 us/op 1.29
mainnet_e58758 - phase0 processRandaoMixesReset 4.7110 us/op 5.3470 us/op 0.88
mainnet_e58758 - phase0 processHistoricalRootsUpdate 1.0530 us/op 649.00 ns/op 1.62
mainnet_e58758 - phase0 processParticipationRecordUpdates 4.2920 us/op 5.1810 us/op 0.83
mainnet_e58758 - phase0 afterProcessEpoch 36.300 ms/op 43.762 ms/op 0.83
phase0 processEffectiveBalanceUpdates - 250000 normalcase 994.97 us/op 1.4995 ms/op 0.66
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 1.6247 ms/op 2.0602 ms/op 0.79
altair processInactivityUpdates - 250000 normalcase 16.856 ms/op 21.428 ms/op 0.79
altair processInactivityUpdates - 250000 worstcase 17.163 ms/op 20.592 ms/op 0.83
phase0 processRegistryUpdates - 250000 normalcase 11.071 us/op 11.245 us/op 0.98
phase0 processRegistryUpdates - 250000 badcase_full_deposits 344.38 us/op 526.10 us/op 0.65
phase0 processRegistryUpdates - 250000 worstcase 0.5 106.03 ms/op 113.99 ms/op 0.93
altair processRewardsAndPenalties - 250000 normalcase 41.893 ms/op 43.912 ms/op 0.95
altair processRewardsAndPenalties - 250000 worstcase 29.576 ms/op 46.526 ms/op 0.64
phase0 getAttestationDeltas - 250000 normalcase 6.7614 ms/op 7.6087 ms/op 0.89
phase0 getAttestationDeltas - 250000 worstcase 6.3687 ms/op 7.7062 ms/op 0.83
phase0 processSlashings - 250000 worstcase 94.808 us/op 136.50 us/op 0.69
altair processSyncCommitteeUpdates - 250000 97.483 ms/op 121.28 ms/op 0.80
BeaconState.hashTreeRoot - No change 482.00 ns/op 234.00 ns/op 2.06
BeaconState.hashTreeRoot - 1 full validator 74.761 us/op 110.52 us/op 0.68
BeaconState.hashTreeRoot - 32 full validator 753.03 us/op 1.2236 ms/op 0.62
BeaconState.hashTreeRoot - 512 full validator 7.5256 ms/op 11.179 ms/op 0.67
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 110.27 us/op 137.93 us/op 0.80
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.6534 ms/op 2.0293 ms/op 0.81
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 18.847 ms/op 23.071 ms/op 0.82
BeaconState.hashTreeRoot - 1 balances 76.935 us/op 98.803 us/op 0.78
BeaconState.hashTreeRoot - 32 balances 892.76 us/op 1.0152 ms/op 0.88
BeaconState.hashTreeRoot - 512 balances 6.9367 ms/op 8.1660 ms/op 0.85
BeaconState.hashTreeRoot - 250000 balances 119.81 ms/op 153.72 ms/op 0.78
aggregationBits - 2048 els - zipIndexesInBitList 19.903 us/op 23.814 us/op 0.84
byteArrayEquals 32 48.136 ns/op 53.734 ns/op 0.90
Buffer.compare 32 15.667 ns/op 17.297 ns/op 0.91
byteArrayEquals 1024 1.2758 us/op 1.5885 us/op 0.80
Buffer.compare 1024 24.292 ns/op 25.763 ns/op 0.94
byteArrayEquals 16384 20.273 us/op 25.277 us/op 0.80
Buffer.compare 16384 181.10 ns/op 193.58 ns/op 0.94
byteArrayEquals 123687377 151.98 ms/op 191.38 ms/op 0.79
Buffer.compare 123687377 5.7967 ms/op 6.3346 ms/op 0.92
byteArrayEquals 32 - diff last byte 47.157 ns/op 52.755 ns/op 0.89
Buffer.compare 32 - diff last byte 15.948 ns/op 17.317 ns/op 0.92
byteArrayEquals 1024 - diff last byte 1.2609 us/op 1.5925 us/op 0.79
Buffer.compare 1024 - diff last byte 24.438 ns/op 26.238 ns/op 0.93
byteArrayEquals 16384 - diff last byte 20.024 us/op 25.326 us/op 0.79
Buffer.compare 16384 - diff last byte 180.39 ns/op 204.50 ns/op 0.88
byteArrayEquals 123687377 - diff last byte 149.75 ms/op 194.62 ms/op 0.77
Buffer.compare 123687377 - diff last byte 5.8631 ms/op 6.9820 ms/op 0.84
byteArrayEquals 32 - random bytes 4.6940 ns/op 5.3490 ns/op 0.88
Buffer.compare 32 - random bytes 15.168 ns/op 17.843 ns/op 0.85
byteArrayEquals 1024 - random bytes 4.7720 ns/op 5.3130 ns/op 0.90
Buffer.compare 1024 - random bytes 14.836 ns/op 17.882 ns/op 0.83
byteArrayEquals 16384 - random bytes 4.7560 ns/op 5.3010 ns/op 0.90
Buffer.compare 16384 - random bytes 15.005 ns/op 17.867 ns/op 0.84
byteArrayEquals 123687377 - random bytes 7.7300 ns/op 6.7000 ns/op 1.15
Buffer.compare 123687377 - random bytes 17.700 ns/op 18.990 ns/op 0.93
regular array get 100000 times 29.579 us/op 35.848 us/op 0.83
wrappedArray get 100000 times 29.548 us/op 34.067 us/op 0.87
arrayWithProxy get 100000 times 9.4023 ms/op 13.229 ms/op 0.71
ssz.Root.equals 42.486 ns/op 47.258 ns/op 0.90
byteArrayEquals 41.199 ns/op 46.529 ns/op 0.89
Buffer.compare 8.6050 ns/op 10.802 ns/op 0.80
processSlot - 1 slots 13.153 us/op 13.402 us/op 0.98
processSlot - 32 slots 3.0018 ms/op 3.0955 ms/op 0.97
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 40.395 ms/op 38.550 ms/op 1.05
getCommitteeAssignments - req 1 vs - 250000 vc 1.7137 ms/op 2.2617 ms/op 0.76
getCommitteeAssignments - req 100 vs - 250000 vc 3.3688 ms/op 4.2529 ms/op 0.79
getCommitteeAssignments - req 1000 vs - 250000 vc 3.6012 ms/op 4.5708 ms/op 0.79
findModifiedValidators - 10000 modified validators 224.60 ms/op 226.25 ms/op 0.99
findModifiedValidators - 1000 modified validators 141.46 ms/op 180.35 ms/op 0.78
findModifiedValidators - 100 modified validators 131.44 ms/op 168.90 ms/op 0.78
findModifiedValidators - 10 modified validators 129.21 ms/op 172.22 ms/op 0.75
findModifiedValidators - 1 modified validators 113.82 ms/op 171.21 ms/op 0.66
findModifiedValidators - no difference 118.90 ms/op 171.46 ms/op 0.69
compare ViewDUs 3.2195 s/op 3.6014 s/op 0.89
compare each validator Uint8Array 1.6128 s/op 1.3366 s/op 1.21
compare ViewDU to Uint8Array 728.03 ms/op 1.2270 s/op 0.59
migrate state 1000000 validators, 24 modified, 0 new 644.14 ms/op 870.02 ms/op 0.74
migrate state 1000000 validators, 1700 modified, 1000 new 900.10 ms/op 1.0390 s/op 0.87
migrate state 1000000 validators, 3400 modified, 2000 new 1.1651 s/op 1.2435 s/op 0.94
migrate state 1500000 validators, 24 modified, 0 new 687.05 ms/op 870.07 ms/op 0.79
migrate state 1500000 validators, 1700 modified, 1000 new 891.02 ms/op 1.1091 s/op 0.80
migrate state 1500000 validators, 3400 modified, 2000 new 1.2005 s/op 1.4065 s/op 0.85
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 6.0700 ns/op 5.1800 ns/op 1.17
state getBlockRootAtSlot - 250000 vs - 7PWei 1.0318 us/op 722.48 ns/op 1.43
computeProposers - vc 250000 6.9106 ms/op 8.3247 ms/op 0.83
computeEpochShuffling - vc 250000 36.032 ms/op 44.264 ms/op 0.81
getNextSyncCommittee - vc 250000 108.07 ms/op 149.46 ms/op 0.72
computeSigningRoot for AttestationData 23.673 us/op 26.738 us/op 0.89
hash AttestationData serialized data then Buffer.toString(base64) 1.1994 us/op 1.6957 us/op 0.71
toHexString serialized data 853.07 ns/op 985.91 ns/op 0.87
Buffer.toString(base64) 165.35 ns/op 196.09 ns/op 0.84
nodejs block root to RootHex using toHex 134.16 ns/op 178.10 ns/op 0.75
nodejs block root to RootHex using toRootHex 81.498 ns/op 114.49 ns/op 0.71
browser block root to RootHex using the deprecated toHexString 325.56 ns/op 273.26 ns/op 1.19
browser block root to RootHex using toHex 178.38 ns/op 230.82 ns/op 0.77
browser block root to RootHex using toRootHex 175.98 ns/op 176.82 ns/op 1.00

by benchmarkbot/action

@twoeths twoeths marked this pull request as ready for review October 30, 2024 09:59
@twoeths twoeths requested a review from a team as a code owner October 30, 2024 09:59
const insertOutcome = chain.attestationPool.add(committeeIndex, attestation, attDataRootHex);
const insertOutcome = chain.attestationPool.add(
committeeIndex,
participationIndex,
Copy link
Member

Choose a reason for hiding this comment

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

what about calling this validatorCommitteeIndex?

Copy link
Member

Choose a reason for hiding this comment

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

imo bitIndex or current name is good

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@wemeetagain
Copy link
Member

@nflaig says this may conflict with devnet-5 changes

Copy link
Member

@nflaig nflaig left a comment

Choose a reason for hiding this comment

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

@twoeths all / most of the changes in this PR are already implemented on devnet-5 branch and merging this would cause a lot of conflicts

Do we just wanna close this and get it shipped when merging devnet-5 to unstable?

@twoeths
Copy link
Contributor Author

twoeths commented Dec 6, 2024

@twoeths all / most of the changes in this PR are already implemented on devnet-5 branch and merging this would cause a lot of conflicts

Do we just wanna close this and get it shipped when merging devnet-5 to unstable?

sounds good to me

@twoeths twoeths closed this Dec 6, 2024
@twoeths twoeths deleted the te/get_single_true_bits branch December 6, 2024 10:02
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