Skip to content

Parallelize cache key computation #6470

Description

@jerenkrantz

Welcome

How did you install golangci-lint?

go install

Your feature request related to a problem? Please describe

Cache key computation (loadIssuesFromCache) can take 600ms+ even for a single-package run because it recursively hashes every file in every transitive dependency, sequentially, on one goroutine. The global mutex in FileHash further serializes concurrent callers.

Describe the solution you'd like

  • Replace hashFileCache global mutex with sync.Map + singleflight.Group for lock-free cache hits and deduplicated concurrent misses
  • Hash all files within a package concurrently in computePkgHash
  • Add PrecomputePackageHashes that walks the full dependency graph in topological order, computing hashes leaf-to-root across all available cores

Describe alternatives you've considered

We confirmed caching of go build and lint caching is present - a significant amount of time during lint is the serial processing of the hashes to compute whether the caches are valid.

Additional context

Draft PR that speeds up hash computation via parallelization in #6468.

Supporter

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or improvement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions