lambdaclass / lambdaclass/lambda_ethereum_consensus

Check performance of `merkleize_chunks`'s reduce

Open
#621 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

perf
Dominant language
Elixir
Stars
109
Forks
41
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked pull request discussion and locate merkleize_chunks. Benchmark its current binary-based reduce on representative large inputs, then compare the performance of accumulating values in a list or array and joining once at the end. Done means the performance impact is measured and the preferred approach is clear.

Written by the indexing model from the issue text.

Assessment

Tech stack
elixir
Domain
performance
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.