foundry icon indicating copy to clipboard operation
foundry copied to clipboard

bug(`forge build`): compilation is extremely slow

Open vseae opened this issue 1 year ago • 5 comments

Component

Forge

Have you ensured that all of these are up to date?

  • [X] Foundry
  • [X] Foundryup

What version of Foundry are you on?

forge 0.2.0 (515a4cc 2024-08-13T00:20:08.991422000Z)

What command(s) is the bug in?

forge build

Operating System

macOS

Describe the bug

[⠔] Compiling... [⠔] Compiling 1 files with Solc 0.8.26 [⠑] Solc 0.8.26 finished in 490.40s

I don't know why,macos sonoma 14.6.1

Is it a problem with my operating system or a network problem? Is the compilation local or depends on the network?

vseae avatar Aug 13 '24 03:08 vseae

Hey @vseae thanks for the report

If possible, could you provide a link to the source code that you are building? A single file should not take that long. When re-running the build step after forge clean are you experiencing the same or similar build time?

zerosnacks avatar Aug 13 '24 20:08 zerosnacks

experiencing a similar issue here

https://github.com/foundry-rs/foundry/issues/8689

alex-roytikh-pop avatar Aug 17 '24 20:08 alex-roytikh-pop

My computer is m3 24gb system version Sonoma 14.6.1

The test script tests a token, inherits the Test contract of forge, and the configuration is enabled via_ir = true, compiler version 0.8.26

When I enable via_ir, it takes me at least a minute to compile a file.

This problem seems to only occur in the inheritance of the forge test contract and the latest macos system.

vseae avatar Aug 22 '24 02:08 vseae

Compiling contract files is several times slower than hardhat.

vseae avatar Aug 22 '24 02:08 vseae

When I enable via_ir, it takes me at least a minute to compile a file.

this is via_ir overhead

all of this is solc time

mattsse avatar Aug 22 '24 03:08 mattsse

resolved by discussion above

jenpaff avatar Sep 24 '24 13:09 jenpaff