lambda_ethereum_consensus icon indicating copy to clipboard operation
lambda_ethereum_consensus copied to clipboard

Check performance of `merkleize_chunks`'s reduce

Open MegaRedHand opened this issue 1 year ago • 0 comments

https://github.com/lambdaclass/lambda_ethereum_consensus/pull/528/files#r1447361541

We can leave this for the next PR, but using a binary as a buffer in Elixir kills performance, in the same way using a tuple does. Each time you modify a binary, the VM has to copy it whole, so this is bound to be really slow for big enough inputs. (unless you do it the right way: https://stackoverflow.com/questions/46095870/whats-the-best-way-to-build-long-strings-in-elixir)

As a simple solution, using a list or array and then joining its values once at the end should work.

MegaRedHand avatar Jan 12 '24 12:01 MegaRedHand