Improves bundle performance by parallelization and utilizing new single walk function in GAF - #161
Draft
z4ce wants to merge 3 commits into
Draft
Improves bundle performance by parallelization and utilizing new single walk function in GAF#161z4ce wants to merge 3 commits into
z4ce wants to merge 3 commits into
Conversation
Replace the two-pass file discovery (GetAllFiles followed by GetFilteredFiles) with GetFilteredFilesSingleWalk, which traverses the project tree once and prunes ignored directories (e.g. node_modules, .git) instead of walking the whole tree and glob-matching every file underneath them. That traversal was the dominant cost on real projects. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Process files with a pool of workers when creating a bundle. The per-file work (stat, read, hash) is I/O-bound and independent across files, so oversubscribing the CPUs keeps the disk busy while syscalls block — this matters most on Windows, where per-file syscalls are comparatively expensive. Results are merged under a mutex, and the lazy filter load is guarded so concurrent workers fetch filters exactly once. Each file is opened a single time and stat'd via the open handle to avoid a redundant filesystem lookup. Also deduplicate the UTF-8 conversion in BundleFileFrom: the content is now converted once and reused for both the hash and the bundle content, via the new util.HashContent helper, instead of converting twice. Add a benchmark covering bundle creation. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
| Status | Scan Engine | Total (0) | ||||
|---|---|---|---|---|---|---|
| Open Source Security | 0 | 0 | 0 | 0 | See details | |
| Licenses | 0 | 0 | 0 | 0 | See details | |
| ✅ | Code Security | 0 | 0 | 0 | 0 | 0 issues |
| ✅ | Secrets | 0 | 0 | 0 | 0 | 0 issues |
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.
|
| Status | Scan Engine | Total (0) | ||||
|---|---|---|---|---|---|---|
| Open Source Security | 0 | 0 | 0 | 0 | See details | |
| Licenses | 0 | 0 | 0 | 0 | See details | |
| ✅ | Code Security | 0 | 0 | 0 | 0 | 0 issues |
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.
fsargent
approved these changes
Jul 24, 2026
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com> Signed-off-by: Felix Sargent <felix.sargent@snyk.io>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Companion PR: snyk/go-application-framework#657
This PR is in relation to this ticket. My testing shows that the changes here reduce bundle creation time from between %50 to %90. Feel free to take whatever you want from this PR and remix it with whatever design might suite engineering better.
I broke these improvements into two commits. The first just uses the single walk from the GAF. I didn't benchmark separately, but for most repos this where the lion's share of performance improvement comes from. The second commit parallelizes the bundle creation. Feel free to pick choose or remix as engineering sees fit.
Checklist
🚨After having merged, please update the
snyk-lsand CLI go.mod to pull in latest client.