perf: avoid eager fingerprint variable evaluation#2883
Open
Napolitain wants to merge 2 commits into
Open
Conversation
This was referenced Jun 18, 2026
andreynering
left a comment
Member
There was a problem hiding this comment.
Hey @Napolitain
I added a comment below. Can you take a look + rebase with main?
| return &new, nil | ||
| } | ||
|
|
||
| func taskReferencesFingerprintVar(t *ast.Task, kind string) bool { |
Member
There was a problem hiding this comment.
We have a lot a new functions in this file. I propose to move all of them to its own file in the taskfile/ast package. What do you think?
Maybe taskfile/ask/fingerprint.go
Contributor
Author
There was a problem hiding this comment.
Yes, I moved them to taskfile/ast/fingerprint.go.
Closed
bd7b227 to
1452a80
Compare
Only compute CHECKSUM or TIMESTAMP template variables when the raw task references the corresponding variable in commands, dependencies, preconditions, or status. This keeps the up-to-date source check unchanged while avoiding a duplicate fingerprint pass for tasks that only use sources and generates caching. Against current main with 20,000 tiny files, checksum improves from 440-445 ms/op to 136-145 ms/op and timestamp from 125-136 ms/op to 44-46 ms/op. Allocations fall from about 742k to 248k for checksum and from about 562k to 188k for timestamp. Verification: go test ./...; golangci-lint run
Move fingerprint-variable reference traversal out of task compilation and into the taskfile AST package as Task.ReferencesFingerprintVar. Keep traversal helpers private and add focused coverage for commands, dependencies, preconditions, status, loops, matrices, nested variables, and nil entries.
1452a80 to
5329fdb
Compare
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.
This is a stacked optimization PR on top of the filesystem benchmark work in #2881. Please review or merge #2881 first; this branch intentionally depends on those benchmarks so the performance impact can be evaluated with the same many-small and few-large fixtures. In this way we can also easily revert a commit if needed, without affecting the test (which is naturally harmless).
That PR avoids duplicate fingerprint evaluation during task compilation
(I think, if I put the base as my branch, then I can't switch of origin)