Skip to content

perf(relayer): optimize timeout processing with drain and Vec#7

Open
songgaoye wants to merge 2 commits intomasterfrom
song/opt_replayer_timeout
Open

perf(relayer): optimize timeout processing with drain and Vec#7
songgaoye wants to merge 2 commits intomasterfrom
song/opt_replayer_timeout

Conversation

@songgaoye
Copy link
Copy Markdown

@songgaoye songgaoye commented Jan 22, 2026

Closes: #XXX

Description

The optimization provides 40-44% performance improvement across all batch sizes by:

  • Replacing HashMap with Vec for sequential index access

  • Eliminating cloning by using drain() instead of iter() + clone()

  • Pre-allocating vector capacity

Batch Size Legacy (clone) Optimized (drain) Improvement
32 286 µs 171 µs 40%
64 548 µs 321 µs 41%
128 1,115 µs 640 µs 43%

PR author checklist:

  • Added changelog entry, using unclog.
  • Added tests: integration (for Hermes) or unit/mock tests (for modules).
  • Linked to GitHub issue.
  • Updated code comments and documentation (e.g., docs/).
    • If guide has been updated, tag GitHub user mircea-c
  • Tagged one reviewer who will be the one responsible for shepherding this PR.

Reviewer checklist:

  • Reviewed Files changed in the GitHub PR explorer.
  • Manually tested (in case integration/unit/mock tests are absent).

@socket-security
Copy link
Copy Markdown

socket-security Bot commented Jan 22, 2026

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedcargo/​clap@​4.5.549910093100100
Addedcargo/​criterion@​0.5.19810098100100

View full report

@randy-cro
Copy link
Copy Markdown

Looks fine to me but probably wanna take into account some of the refactoring upstream PR/changes provided by the reviewer? Also could we somehow test this on devnet (can use the attestation-layer one actually since there are ibc events every x blocks) to see if there are any bugs or is there significant improvement

@songgaoye
Copy link
Copy Markdown
Author

updated

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants