Skip to content

Conversation

DaniPopes
Copy link
Member

@DaniPopes DaniPopes commented Oct 5, 2025

Puts #699 behind a feature flag. 60 impls is 3x slower to compile than 24, this is for only alloy-sol-types, so it does not include potential slowdowns downstream in users of sol! and such. It's at 6-6.5s on a clean build of forge.

This is technically a breaking change but having >24 fields in a struct is something that's already so niche that I really don't mind fixing compile times for everyone else.

$ hyperfine --warmup 1 --prepare "cargo clean -p alloy-sol-types" --parameter-list n 16,24,32,40,48,60,72 "./gen_macros.py {n} && cargo b -p alloy-sol-types"
Benchmark 1: ./gen_macros.py 16 && cargo b -p alloy-sol-types
  Time (mean ± σ):     755.8 ms ±   9.5 ms    [User: 782.3 ms, System: 118.2 ms]
  Range (min … max):   742.1 ms … 770.0 ms    10 runs
 
Benchmark 2: ./gen_macros.py 24 && cargo b -p alloy-sol-types
  Time (mean ± σ):      1.004 s ±  0.020 s    [User: 1.026 s, System: 0.121 s]
  Range (min … max):    0.987 s …  1.038 s    10 runs
 
Benchmark 3: ./gen_macros.py 32 && cargo b -p alloy-sol-types
  Time (mean ± σ):      1.344 s ±  0.023 s    [User: 1.347 s, System: 0.137 s]
  Range (min … max):    1.314 s …  1.382 s    10 runs
 
Benchmark 4: ./gen_macros.py 40 && cargo b -p alloy-sol-types
  Time (mean ± σ):      1.791 s ±  0.025 s    [User: 1.783 s, System: 0.146 s]
  Range (min … max):    1.751 s …  1.821 s    10 runs
 
Benchmark 5: ./gen_macros.py 48 && cargo b -p alloy-sol-types
  Time (mean ± σ):      2.320 s ±  0.033 s    [User: 2.301 s, System: 0.156 s]
  Range (min … max):    2.295 s …  2.378 s    10 runs
 
Benchmark 6: ./gen_macros.py 60 && cargo b -p alloy-sol-types
  Time (mean ± σ):      3.339 s ±  0.065 s    [User: 3.291 s, System: 0.173 s]
  Range (min … max):    3.198 s …  3.397 s    10 runs
 
Benchmark 7: ./gen_macros.py 72 && cargo b -p alloy-sol-types
  Time (mean ± σ):      4.609 s ±  0.135 s    [User: 4.503 s, System: 0.222 s]
  Range (min … max):    4.462 s …  4.934 s    10 runs
 
Summary
  ./gen_macros.py 16 && cargo b -p alloy-sol-types ran
    1.33 ± 0.03 times faster than ./gen_macros.py 24 && cargo b -p alloy-sol-types
    1.78 ± 0.04 times faster than ./gen_macros.py 32 && cargo b -p alloy-sol-types
    2.37 ± 0.04 times faster than ./gen_macros.py 40 && cargo b -p alloy-sol-types
    3.07 ± 0.06 times faster than ./gen_macros.py 48 && cargo b -p alloy-sol-types
    4.42 ± 0.10 times faster than ./gen_macros.py 60 && cargo b -p alloy-sol-types
    6.10 ± 0.19 times faster than ./gen_macros.py 72 && cargo b -p alloy-sol-types

@DaniPopes DaniPopes force-pushed the dani/all-tuples-feature branch from c0c5c9a to 05ae700 Compare October 5, 2025 18:23
Copy link
Contributor

@onbjerg onbjerg left a comment

Choose a reason for hiding this comment

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

makes sense to me, do we know who would be affected by this?

@github-project-automation github-project-automation bot moved this to Reviewed in Alloy Oct 6, 2025
@DaniPopes
Copy link
Member Author

Don't know of any besides original PR author. cc @MatheoGrivault
My initial count of 24 was based on a basic analysis of all structs on GitHub searched with "lang: Solidity".

@DaniPopes DaniPopes merged commit 2ce9079 into main Oct 7, 2025
32 checks passed
@DaniPopes DaniPopes deleted the dani/all-tuples-feature branch October 7, 2025 16:00
@github-project-automation github-project-automation bot moved this from Reviewed to Done in Alloy Oct 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants