Repository navigation
perf(core): assemble and link objects without inner dependencies in the worker - #855
Conversation
f4d6435 to
63ce7d1
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
Cross-process linking and artifact lifetimes warrant human validation, with regression coverage still needed for worker and parent paths.
1 open issue
What changed in this PR
Moves assembly and linking of self-contained objects into compiler workers, reducing serial work in the parent process.
Changes:
- Passes library addresses and assembled runtime objects to workers.
- Preserves assembled objects for dependent contracts.
- Records worker assembly and linking under
AssembleLink.
| File | Description |
|---|---|
| solx-core/src/project/mod.rs | Supplies linker symbols and runtime artifacts. |
| solx-core/src/project/contract/mod.rs | Runs and profiles worker-side linking. |
| solx-core/src/process/session.rs | Shares library addresses with workers. |
| solx-core/src/process/job.rs | Carries assembled runtime bytecode. |
| solx-core/src/process/child.rs | Forwards linking inputs to compilation. |
| solx-core/src/build/mod.rs | Handles mixed object stages and parent fallback. |
| solx-core/src/build/contract/object.rs | Tracks stages and preserves assembled artifacts. |
Review effort: Balanced
63ce7d1 to
33860bc
Compare
Coverage Summary
|
0b63a1d to
a7be30c
Compare
Compile-time benchmark (
|
| binary | median | mean ± σ | min … max | vs baseline |
|---|---|---|---|---|
| pr | 0.224 s | 0.224 s ± 0.004 s | 0.217 s … 0.232 s | 0.994× |
| main | 0.225 s | 0.226 s ± 0.004 s | 0.220 s … 0.232 s | 1.000× |
| prerelease | 0.434 s | 0.433 s ± 0.007 s | 0.421 s … 0.443 s | 1.930× |
openzeppelin-contracts-0.34--solx-legacy-dwarf
| binary | median | mean ± σ | min … max | vs baseline |
|---|---|---|---|---|
| pr | 1.608 s | 1.610 s ± 0.008 s | 1.601 s … 1.628 s | 0.903× |
| main | 1.780 s | 1.778 s ± 0.007 s | 1.769 s … 1.791 s | 1.000× |
| prerelease | 2.935 s | 2.935 s ± 0.015 s | 2.899 s … 2.950 s | 1.649× |
uniswap-v4-core-solx--solx-legacy-dwarf
| binary | median | mean ± σ | min … max | vs baseline |
|---|---|---|---|---|
| pr | 0.695 s | 0.699 s ± 0.011 s | 0.687 s … 0.719 s | 0.954× |
| main | 0.729 s | 0.730 s ± 0.009 s | 0.718 s … 0.746 s | 1.000× |
| prerelease | 1.889 s | 1.884 s ± 0.026 s | 1.852 s … 1.923 s | 2.592× |
Sourcify sweep
Candidate-only failures (42)kinds:
Failures shared with the reference (reference diagnostics) (151)kinds:
|
🧪 Integration tests — standard · PR vs
|
| Suite | New failures | Size Δ | Gas Δ | Report |
|---|---|---|---|---|
| solx-tester | ✅ 0 | ✅ 0 of 26,774 | ✅ 0 of 36,849 | solx-tester-report.xlsx ↓ |
| Foundry · 26 proj | ✅ 0 (410 pre-existing) | ✅ 0 of 1,864 | ⚪ jitter 6 of 3,303, median 0.2% (not gated) | foundry-report.xlsx ↓ |
| Hardhat · 3 proj | ✅ 0 | ⚪ not collected | ⚪ not collected | hardhat-report.xlsx ↓ |
Compile time — wall-clock tripwire, positive = PR slower (authoritative Δ in the compile-time benchmark comment)
| Suite | legacy (agg / median) |
|---|---|
| Foundry · 26 proj | -2.7% / -2.7% |
| Hardhat · 3 proj | -0.3% / +3.2% |
Within noise — no suite ≥ 5%, no project ≥ 15%.
There was a problem hiding this comment.
Two findings with no single line, and one proposal.
Per-iteration deep copy in the fixpoint loop (build/mod.rs:65-75). The old code's lookup map held &str -> &Object borrows; the new one clones every assembled object's full bytecode, and the loop rebuilds it on every pass — one copy of the build's bytecode per dependency level, in a PR whose point is cutting link time. The owned map is needed because assemble is &mut self now, but it can be built once outside the loop and extended after each assemble, keeping one copy total.
3bf56d5 to
b6173ce
Compare
147f51b to
722243d
Compare
1ba6829 to
3af2328
Compare
3c27bdd to
0485acb
Compare

Objects that depend on no other contract's object are assembled and linked by the worker that compiled them instead of in the parent's serial loop after every worker has returned; only objects that embed another contract still wait for the parent's dependency walk.
AssembleLinkbenchmark stage times the work in the worker.solx-llvmis pinned to [lld][EVM] Assemble and link EVM objects on one thread solx-llvm#208, which links every object on one lld thread; the combined column below includes it.Benchmark: Apple M2 Max (12 cores, 64 GB), macOS 27.0.1, 12 threads, RelWithDebInfo LLVM, one warm-up then 5 runs, medians;
--standard-jsonon thetests/benchmark/fixturesprojects,--bin -O3on 114 single files oftests/solidity/simple. Bytecode, link references and messages byte-identical on every input in every configuration.The parent's cost was 0.22 ms to assemble and 0.14 ms to link per object regardless of its size, so it scaled with the object count; what remains in the parent is the objects that embed other contracts. On a single file this change alone moves the work to the worker, and the lld change is what shortens the wall.