Skip to content

perf: schedule large contracts first in parallel compilation (LPT)#309

Open
hedgar2017 wants to merge 1 commit intomainfrom
perf/lpt-parallel-compilation
Open

perf: schedule large contracts first in parallel compilation (LPT)#309
hedgar2017 wants to merge 1 commit intomainfrom
perf/lpt-parallel-compilation

Conversation

@hedgar2017
Copy link
Contributor

@hedgar2017 hedgar2017 commented Mar 26, 2026

  • Sort contracts by estimated compilation cost (descending) before parallel dispatch in compile_to_evm()
  • Uses par_bridge() for FIFO scheduling — worker threads pull contracts from the sorted queue in order
  • Large contracts start compiling first, reducing long-tail idle time when a single big contract would otherwise be the last one running while all other threads sit idle

Test plan

  • check if any projects have improved on compilation time

@hedgar2017 hedgar2017 requested a review from Copilot March 26, 2026 03:18
@hedgar2017 hedgar2017 self-assigned this Mar 26, 2026
@hedgar2017 hedgar2017 added the ci:integration Trigger integration tests workflow on PR label Mar 26, 2026
@hedgar2017 hedgar2017 requested review from a team March 26, 2026 03:22
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to reduce parallel compilation tail latency by scheduling the most expensive contracts first (LPT-style) before dispatching work in Project::compile_to_evm().

Changes:

  • Added Contract::estimated_compilation_cost() to estimate relative compilation cost from the contract’s IR representation.
  • Updated Project::compile_to_evm() to sort contracts by estimated cost (descending) and dispatch them via a FIFO-ish work queue using par_bridge().

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
solx-core/src/project/mod.rs Sorts contracts by estimated cost and switches parallel dispatch to par_bridge() to prioritize large contracts.
solx-core/src/project/contract/mod.rs Introduces a cost-estimation helper used for scheduling decisions.

@hedgar2017 hedgar2017 force-pushed the perf/lpt-parallel-compilation branch 2 times, most recently from e7ef7a3 to dae55eb Compare March 26, 2026 03:31
Sort contracts by estimated compilation cost descending before parallel
dispatch so that large contracts begin compiling first, reducing the
long-tail idle time when a single big contract is the last one running.

Uses par_bridge for FIFO scheduling guarantee via mutex-serialized
iterator consumption.
@hedgar2017 hedgar2017 force-pushed the perf/lpt-parallel-compilation branch from b61b398 to a69795e Compare March 26, 2026 03:40
@github-actions
Copy link

📊 solx Tester Report

➡️ Download

@github-actions
Copy link

📊 Hardhat Projects Report

➡️ Download

@github-actions
Copy link

📊 Foundry Projects Report

➡️ Download

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

Labels

ci:integration Trigger integration tests workflow on PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants