uttrflow / uttrflow/uttrflow-swift

AI suggestions stat every entry of a large directory every few seconds, and never offer a name past the first 200

Open
#767 0 comments 0 reactions 0 assignees View on GitHub
area:ai-suggestions bug P2
Dominant language
Swift
Stars
4
Forks
17
Avg merge
3h 32m
Merged PRs (30d)
277

Description

## What happens

`SystemEnvironmentReader.entries(under:from:directoriesOnly:)` (`Sources/UttrflowPredict/EnvironmentReading+System.swift`) reads a whole directory, then for `.directories` stats every entry, then sorts and keeps the first 200 names.

Measured for #764 on a directory of 10,000 entries (9,000 files, 1,000 directories), under heavy machine load: 29 ms for the files, 41 ms for the directories, once every 5 seconds per directory while someone types. The cut is alphabetical, so a completion or an attestation for a name past the 200th is never offered: in that directory, `cd sub_9` has nothing to choose from.

## What should happen

The listing is bounded in work, not only in what it returns: names beginning with the typed word are chosen before any stat, and only the chosen names are stat'ed. #764 already checks a whole line with one `stat` per path, so this only affects what the machine offers, not what it allows.

## Related

#764, #751

Contributor guide

Open the contributing guide

Research direction

Start at SystemEnvironmentReader.entries(under:from:directoriesOnly:) in Sources/UttrflowPredict/EnvironmentReading+System.swift and trace how directory entries are selected, sorted, and stat'ed. Compare the behavior with the measurements in the issue and related issue #764; done means matching names are prioritized before stat calls, only selected names are stat'ed, and names beyond the first 200 can be offered.

Written by the indexing model from the issue text.

Assessment

Tech stack
macos, swift
Domain
operating-systems, performance
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
75/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.