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

Go Build: Debugging Go compiler performance in a large codebase #6

Open
ryan961 opened this issue Jan 26, 2024 · 0 comments
Open

Go Build: Debugging Go compiler performance in a large codebase #6

ryan961 opened this issue Jan 26, 2024 · 0 comments
Labels
Golang All things associated with Go. Perf Performance Optimization Reading Daily Reading

Comments

@ryan961
Copy link
Owner

ryan961 commented Jan 26, 2024

🤖 AI Summary

This article outlines various strategies for speeding up Go builds, making them significantly faster. It highlights practical steps such as reducing binary size, leveraging caching effectively, and parallelizing builds. The authors detail their hands-on experience with optimization and provide insights into how incremental builds, build tags, and avoiding cgo can lead to faster build times. These techniques are particularly useful for teams looking to streamline their development and deployment processes in projects using the Go programming language.

🖇️ Details

🔖 Note

This article provides a good idea for deep optimization of the go build compilation process (although the projects I am currently encountering have not reached such requirements 🙃). Here are two interesting points to note:

  1. By passing some interesting flags (-debug-trace...) to go build, generate a trace file and import it into visualization tools like Perfetto for targeted compilation optimization

  2. Using depguard (a great linter that can rule out import cycles), restrict pkg/domain from importing anything beyond the standard library

    linters:
    enable:
      - depguard
      - ...
    linter-settings:
    depguard:
      rules:
      domain-no-deps:
        files:
          # this rule applies to anything within pkg/domain
          - "**/pkg/domain/***"
          # Exclude any test files which can import whateverthey like
          - "!$test"
        allow:
          - "$gostd"
@ryan961 ryan961 added Golang All things associated with Go. Reading Daily Reading Perf Performance Optimization labels Jan 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Golang All things associated with Go. Perf Performance Optimization Reading Daily Reading
Projects
None yet
Development

No branches or pull requests

1 participant