Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misc optimizations #3053

Merged
merged 38 commits into from
Aug 30, 2022
Merged

Misc optimizations #3053

merged 38 commits into from
Aug 30, 2022

Conversation

alcuadrado
Copy link
Member

Sixth PR of the compilation times optimization effort.

This PR introduces multiple smaller optimizations:

  • I created an fs-util module to replace slower dependencies with it (e.g. glob)
  • Stopped using loadash whenever possible, and only load its necessary modules when we still use it.
  • Use execFile instead of exec to run the compiler, as exec spawns a new shell (!!!!!!)
  • Don't import hardhat/console.sol in the sample project as it's slow to compile.
  • Some hardhat load time optimizations — Mostly requiring things when needed instead of at the top of the file
  • Cache the solidity files resolution results — We were reading each file multiple times (!)
  • We were reading some files just to check for their existence (!)

WIP: Parts of this require tests.

Depends on #3052

@changeset-bot
Copy link

changeset-bot bot commented Aug 17, 2022

⚠️ No Changeset found

Latest commit: 7ade54c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link

vercel bot commented Aug 17, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
hardhat ✅ Ready (Inspect) Visit Preview Aug 30, 2022 at 0:55AM (UTC)
hardhat-storybook ✅ Ready (Inspect) Visit Preview Aug 30, 2022 at 0:55AM (UTC)

@github-actions
Copy link
Contributor

This issue is also being tracked on Linear.

We use Linear to manage our development process, but we keep the conversations on Github.

LINEAR-ID: c89d90fa-1b26-46d6-9b84-f77b0d70ea5e

packages/hardhat-core/src/internal/util/fs-utils.ts Outdated Show resolved Hide resolved
packages/hardhat-core/src/internal/util/fs-utils.ts Outdated Show resolved Hide resolved
packages/hardhat-core/src/internal/util/fs-utils.ts Outdated Show resolved Hide resolved
packages/hardhat-core/src/internal/util/fs-utils.ts Outdated Show resolved Hide resolved
packages/hardhat-core/src/internal/util/fs-utils.ts Outdated Show resolved Hide resolved
packages/hardhat-core/src/internal/artifacts.ts Outdated Show resolved Hide resolved
packages/hardhat-core/src/internal/solidity/resolver.ts Outdated Show resolved Hide resolved
packages/hardhat-core/src/utils/source-names.ts Outdated Show resolved Hide resolved
@alcuadrado
Copy link
Member Author

Finally ready! This should have been a few prs.

Handling different filesystems at the same time is so painful!

Copy link
Member

@fvictorio fvictorio left a comment

Choose a reason for hiding this comment

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

Minor comment; pre-approving.

Co-authored-by: Franco Victorio <victorio.franco@gmail.com>
@alcuadrado alcuadrado merged commit f9ac8cb into compiler-optimizations Aug 30, 2022
@alcuadrado alcuadrado deleted the misc-optimizations branch August 30, 2022 13:34
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants