Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf(changelog): cache commit retain checks (258 times faster generat…
…ion) (#772) * perf: cache commit retain checks + 87 times faster generation This caches the commit retain checks whenever include/exclude paths are specified. This speeds up changelog generation by `87` times in a big repository I have: ``` Now: 0.237 s Before: 20.633 s ``` * perf: use separate retain_commit cache for each repository * fix: use cacache for parallel git-local cache - 258 times faster Sled fails to open the cache if multiple git-cliff processes run on the same repository. This fixes the issue by using cacache which stores the cache locally under .git/git-cliff * fix: cache changed files of a commit directly This slows down the retain_commit check by ~2 times, but allows reusing the cache in case the include/exclude patterns change. This is beneficial for running in monorepos where git-cliff runs multiple times to generate changelog for different subsets of the repo * fix: consider include/exclude patterns together * fix: handle first commit for changed_files * fix: normalize glob patterns to ignore ./ * docs: add docs for retain_commit_check and cache algorithms * fix: add ** if a pattern represents a directory * test: add tests for should retain commit checks * fix: correctly get the files list for the first commit * test: add test email/name for git commits * fix: use / for path joining in entries to match the git behaviour * fix: revert change of include/exclude patterns to slices The slices are normalized, so an owned pattern is needed to avoid type mismatch between new normalized/unchanged patterns * refactor: polish implementation * refactor: apply clippy suggestion --------- Co-authored-by: Orhun Parmaksız <[email protected]>
- Loading branch information