ChainSafe / lodestar

🌟 TypeScript Implementation of Ethereum Consensus
https://lodestar.chainsafe.io
Apache License 2.0
1.19k stars 300 forks source link

deserializeUint8ArrayBitListFromBytes ssz api performance issue #7206

Open twoeths opened 1 month ago

twoeths commented 1 month ago

Describe the bug

This ssz api takes 2.5% time of a holesky node subscribing to all subnets

Screenshot 2024-10-29 at 16 02 30

holesky_subscribe_all_subnets_main.cpuprofile.zip

Expected behavior

I see some Uint8Array.slice() api there, see if we can improve by using Uint8Array.subarray() to avoid memory allocation

part of #7186

Steps to reproduce

No response

Additional context

No response

Operating system

Linux

Lodestar version or commit hash

unstable and v1.22.0

twoeths commented 4 weeks ago

getAggregationBitsFromAttestationSerialized() really caused gc due to its memory allocation

Screenshot 2024-10-30 at 10 26 13