Reduce nested loops in subgraph mappings
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 5
- Forks
- 7
- Avg merge
- 4h 1m
- Merged PRs (30d)
- 6
Description
Some subgraph mappings use nested loops (e.g. roundsManager.ts broadcaster tracking). While functional today, nested iteration in mappings can become expensive as data grows and may impact indexing performance:
- https://github.com/livepeer/subgraph/blob/4728c850169b99b4109be9daf392531ca50766c1/src/mappings/roundsManager.ts#L158
- https://github.com/livepeer/subgraph/blob/4728c850169b99b4109be9daf392531ca50766c1/src/mappings/roundsManager.ts#L199
Goal: Refactor mapping logic to avoid nested loops by using more efficient data structures or indexing strategies.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/mappings/roundsManager.ts at the referenced lines 158 and 199, and trace the broadcaster-tracking mapping logic around those handlers. Identify the data structures or indexing strategies used there; done means the mapping avoids nested loops while preserving current behavior and improving indexing efficiency as data grows.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- data, performance
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100