Skip to content

perf: optimize getBlockTransactionDetails()#5224

Open
bootcodes wants to merge 4 commits intohiero-ledger:mainfrom
bootcodes:4904-reduce-call-complexity
Open

perf: optimize getBlockTransactionDetails()#5224
bootcodes wants to merge 4 commits intohiero-ledger:mainfrom
bootcodes:4904-reduce-call-complexity

Conversation

@bootcodes
Copy link
Copy Markdown
Contributor

@bootcodes bootcodes commented Apr 6, 2026

Description

This PR introduces a fix to improve the performance bottleneck from O(N^2) complexity to O(N) for getBlockTransactionDetails() method in src/relay/lib/debug.ts

Related issue(s)

Fixes #4904

Testing Guide

  1. Run tests

Changes from original design (optional)

N/A

Additional work needed (optional)

N/A

Checklist

  • I've assigned an assignee to this PR and related issue(s) (if applicable)
  • I've assigned a label to this PR and related issue(s) (if applicable)
  • I've assigned a milestone to this PR and related issue(s) (if applicable)
  • I've updated documentation (code comments, README, etc. if applicable)
  • I've done sufficient testing (unit, integration, etc.)

Signed-off-by: Thomas Boot <thomas.boot@swirldslabs.com>
@bootcodes bootcodes self-assigned this Apr 6, 2026
@bootcodes bootcodes added the perf performance gains label Apr 6, 2026
@bootcodes bootcodes added this to the 0.77.0 milestone Apr 6, 2026
@bootcodes bootcodes marked this pull request as ready for review April 6, 2026 09:52
@bootcodes bootcodes requested review from a team as code owners April 6, 2026 09:52
@bootcodes bootcodes requested a review from acuarica April 6, 2026 09:52
@codacy-production
Copy link
Copy Markdown

codacy-production bot commented Apr 6, 2026

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 10 complexity · 0 duplication

Metric Results
Complexity 10
Duplication 0

View in Codacy

TIP This summary will be updated as you push new changes. Give us feedback

jasuwienas
jasuwienas previously approved these changes Apr 9, 2026
Copy link
Copy Markdown
Contributor

@jasuwienas jasuwienas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Co-authored-by: jasuwienas <mariusz@jasuwienas.pl>
Signed-off-by: Thomas Boot <thomas.boot@swirldslabs.com>
Copy link
Copy Markdown
Contributor

@quiet-node quiet-node left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG just two small items

Signed-off-by: Thomas Boot <thomas.boot@swirldslabs.com>
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 10, 2026

Codecov Report

❌ Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/relay/lib/debug.ts 0.00% 4 Missing ⚠️

❌ Your project check has failed because the head coverage (71.16%) is below the target coverage (80.00%). You can increase the head coverage or adjust the target coverage.

❗ There is a different number of reports uploaded between BASE (efb14b5) and HEAD (630098a). Click for more details.

HEAD has 18 uploads less than BASE
Flag BASE (efb14b5) HEAD (630098a)
21 3
@@             Coverage Diff             @@
##             main    #5224       +/-   ##
===========================================
- Coverage   95.92%   71.16%   -24.77%     
===========================================
  Files         146      146               
  Lines       25182    25184        +2     
  Branches     2051      741     -1310     
===========================================
- Hits        24157    17921     -6236     
- Misses       1002     7245     +6243     
+ Partials       23       18        -5     
Files with missing lines Coverage Δ
src/relay/lib/debug.ts 40.76% <0.00%> (-58.98%) ⬇️

... and 89 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

@quiet-node quiet-node left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

perf performance gains

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[perf] O(N^2) complexity in getBlockTransactionDetails()

4 participants