Skip to content

P6: LRU memo for LintCache.fingerprint across configs #549

@Jason-Abbott

Description

@Jason-Abbott

Location: Sources/SwiftiomaticKit/Support/LintCache.swift:143

fingerprint(for:) memoizes a single (Configuration, fingerprint) pair via lastFingerprint. When a project has multiple .swift-format overrides per directory, the memo thrashes — every file that switches configs triggers a full re-encode of the Configuration to sorted-keys JSON plus a SHA-256 hash.

Potential performance benefit

For monorepos with N distinct configs, replaces N×files re-encodes with N total re-encodes (cache size = N). A configuration encode + sorted-keys JSON serialization + SHA-256 of multi-KB JSON is non-trivial; eliminating thrash matters for projects with several nested overrides.

Reason deferred

Single-config projects (the common case) already hit the existing memo. Need to measure that monorepo overrides actually thrash in practice before adding LRU complexity. Reasonable approach: key by a cheap config hash (e.g. hash of Configuration's memberwise comparison fields) and keep an LRU of last 4–8 configs.

👾 This issue is managed by Jig. Edits made here will be overwritten.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions