js-libp2p
js-libp2p copied to clipboard
Excessive time spent `slice`ing `Uint8ArrayList`
Profiling https://github.com/ChainSafe/lodestar/pull/4114 shows there is now excessive time spent sliceing Uint8ArrayLists.
Self Total Function Library
35.32 % 35.32 % concat concat.js:1 uint8arrays
35.32 % 35.32 % slice index.js:121 uint8arraylist
9.75 % 9.75 % ReadHandlers decode.js:11 it-length-prefixed
8.49 % 8.49 % decoder decode.js:59 it-length-prefixed
8.39 % 8.39 % (anonymous) index.js:28 it-handshake
4.29 % 4.29 % write decode.js:8 mplex
4.29 % 4.29 % bytesDecode bytes.js:13 protons-runtime
For more information, uint8arraylist is not a direct dependency of js-libp2p, it's from
- "_project_#it-handshake#it-reader" depends on it
- Hoisted from "_project_#it-handshake#it-reader#uint8arraylist"
- Hoisted from "_project_#@lodestar#beacon-node#@chainsafe#libp2p-noise#uint8arraylist"
- Hoisted from "_project_#@lodestar#beacon-node#@libp2p#mplex#uint8arraylist"
- Hoisted from "_project_#@lodestar#beacon-node#@chainsafe#libp2p-gossipsub#it-length-prefixed#uint8arraylist"
- Hoisted from "_project_#@lodestar#beacon-node#@chainsafe#libp2p-noise#it-pb-stream#uint8arraylist"
- Hoisted from "_project_#@lodestar#beacon-node#@chainsafe#libp2p-noise#protons-runtime#uint8arraylist"
- Hoisted from "_project_#@lodestar#beacon-node#libp2p#@libp2p#multistream-select#uint8arraylist"
Closing as the issue should be resolved - please re-open if you continue to observe it.