Skip to content

perf(engine): skip ignored directories before descending into them - #34

Merged
PopovVA merged 1 commit into
mainfrom
perf/discover-skip-dirs
Jul 17, 2026
Merged

perf(engine): skip ignored directories before descending into them#34
PopovVA merged 1 commit into
mainfrom
perf/discover-skip-dirs

Conversation

@PopovVA

@PopovVA PopovVA commented Jul 17, 2026

Copy link
Copy Markdown
Owner

Summary

_discover used listSync(recursive: true), which walks the entire tree — including .git, .dart_tool, build, node_modules — and materializes the full file list in memory before any filtering happens. On large repositories this wastes time and memory for entries that are always discarded.

Discovery now walks one directory level at a time and skips ignored directories before descending into them. Files are still yielded lazily; per-level sorting keeps discovery deterministic, and findings are re-sorted globally in audit(), so report order is unchanged.

Test

The new engine test locks a subdirectory of .git with chmod 000: the old flat recursive listing throws on it before filtering (verified — the test fails on the previous implementation), while the new walk never enters .git at all.

Closes #31

@PopovVA
PopovVA merged commit 2911ae9 into main Jul 17, 2026
1 check passed
@PopovVA
PopovVA deleted the perf/discover-skip-dirs branch July 17, 2026 19:53
PopovVA added a commit that referenced this pull request Jul 17, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.6.0](v0.5.1...v0.6.0)
(2026-07-17)


### Features

* **sd001:** detect secrets in map entries, parameter defaults and named
arguments ([#36](#36))
([6658f0a](6658f0a)),
closes [#33](#33)


### Bug Fixes

* **rules:** locate() skips matches inside XML comments
([#35](#35))
([a429cac](a429cac)),
closes [#32](#32)


### Performance Improvements

* **engine:** skip ignored directories before descending into them
([#34](#34))
([2911ae9](2911ae9)),
closes [#31](#31)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Performance: Directory traversal bottleneck on large repositories

1 participant