js-libp2p icon indicating copy to clipboard operation
js-libp2p copied to clipboard

Excessive time spent `slice`ing `Uint8ArrayList`

Open wemeetagain opened this issue 3 years ago • 1 comments

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

wemeetagain avatar Jul 23 '22 13:07 wemeetagain

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"

twoeths avatar Jul 25 '22 07:07 twoeths

Closing as the issue should be resolved - please re-open if you continue to observe it.

achingbrain avatar Sep 06 '22 15:09 achingbrain