-
-
Notifications
You must be signed in to change notification settings - Fork 811
Description
Description
When using method: timestamp with glob patterns like **/*.gql that match thousands of files across a large directory tree, the fingerprinting step is significantly slower than expected (~6.6s for ~5000 matching files in a monorepo).
What did you do?
Created a task with method: timestamp and source globs like:
sources:
- /path/to/monorepo/schema/**/*.gql
- /path/to/monorepo/app/src/**/*.gql
- /path/to/monorepo/app/scripts/codegen/**/*
generates:
- /tmp/output.txtWhat did you expect to happen?
The up-to-date check should be fast since it only needs to compare file modification times.
What happened instead?
The check takes ~6.6s because:
-
Globs()usesexecext.ExpandFieldswhich shells out to expand glob patterns into a complete file list before any timestamp comparison. For**/*.gqlpatterns matching thousands of files, this is very expensive (~2.7s per call). -
Value()is called redundantly: IncompiledTask()(variables.go:184), theValue()call is not gated byevaluateShVars. SinceRunTaskcalls bothFastCompiledTaskandCompiledTasksequentially (task.go:142andtask.go:159),Value()runs twice — adding ~2.7s of unnecessary overhead. -
No short-circuiting in
IsUpToDate: All globs are fully expanded into a file list before any timestamp comparison begins. For the common "up-to-date" case, this means stating every single matching file even though only one newer file would be enough to decide.
Version
Latest main (commit 54bdcba)
Operating system
macOS (Darwin 25.3.0), but the issue is platform-independent — it affects any large directory tree with ** glob patterns.