Suggest an idea for Knip
This is a performance improvement suggestion which is needed after knip switched from fast-glob to tinyglobby:
When a package.json exports/imports map is expanded into entry paths, those targets are handed straight to tinyglobby.
In a large monorepo with generated-types workspaces, one map can expand to many (tens of thousands in our repo) literal patterns. tinyglobby tests each walked entry against every compiled pattern even though a literal can only match one exact path.
Suggested fix: In glob(), we can split patterns into literals vs real globs. Literals can be resolved directly with isFile() (the fast path), and only real globs can be passed is tinyGlob.
In our large monorepo, patching this decreased our knip runtime from 10+ min to ~1.5 minutes.
Suggest an idea for Knip
This is a performance improvement suggestion which is needed after knip switched from fast-glob to tinyglobby:
When a package.json exports/imports map is expanded into entry paths, those targets are handed straight to tinyglobby.
In a large monorepo with generated-types workspaces, one map can expand to many (tens of thousands in our repo) literal patterns. tinyglobby tests each walked entry against every compiled pattern even though a literal can only match one exact path.
Suggested fix: In
glob(), we can splitpatternsinto literals vs real globs. Literals can be resolved directly withisFile()(the fast path), and only real globs can be passed istinyGlob.In our large monorepo, patching this decreased our knip runtime from 10+ min to ~1.5 minutes.