Skip to content

FOLLOW-UP: isIncludedFile O(1) via watcher's extras map (from PR #256) #264

Description

@adnaan

Context

PR #256 added isIncludedFile in internal/server/server.go to filter watcher events to only included files.

Source PR: #256
Suggested by: @claude[bot]
Comment type: PR review (round 8)

Task Description

Current implementation iterates all pages and checks each page's IncludedFiles slice — O(pages × includes-per-page) per FS event. The watcher already maintains an extra map (the set passed via SetExtraFiles) used for the same filtering at the fsnotify subscription level.

Expose a method like s.watcher.IsExtra(absPath) and have isIncludedFile delegate to it. O(1) lookup, removes a redundant scan path.

Original Comment

isIncludedFile has O(pages × files) complexity per watcher event. The extra map already maintained in Watcher could be consulted directly. Consider delegating: s.watcher.IsExtra(absPath) would be O(1).
@claude[bot], round 8


Auto-created by /prmonitor from PR review comments.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P4-backlogBacklog: future, nice-to-havefollow-upFollow-up task from PR reviewfrom-reviewIssue originated from PR review

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions