ssz
ssz copied to clipboard
Improve intToBytes, bytesToInt for number
Is your feature request related to a problem? Please describe. Right now these utils convert to BigInt unnecessarily and we know that we have performance issue with using BigInt
Describe the solution you'd like
Reimplement these functions without going through bigint-buffer
@tuyennhv According to a CPU profile are the intToBytes, bytesToInt functions part of a critically hot path worth optimizing?
@tuyennhv According to a CPU profile are the intToBytes, bytesToInt functions part of a critically hot path worth optimizing?
no this is not critical, these functions just use BigInt unnecessarily so we want to improve them to avoid some memory allocation whenever possible.
https://github.com/ChainSafe/lodestar/pull/2213
Can this be closed since the above PR tried to do this but the trade offs were not good enough? Or are you guys still looking for a better implementation?
@filipesmedeiros We are still looking for a better implementation! However this should be implemented in ssz rather than here. Will move the issue, feel free to propose better strategies, in ssz we have already benchmarking infrastructure setup