Skip to content

[Feature Request]: Optimize _match_missing_file #610

Open
@Toby222

Description

@Toby222

Checklist

  • I am using an up-to-date version.
  • I have read the documentation.
  • I have searched existing issues.

TagStudio Version

Alpha 9.4.0+

Operating System & Version

NixOS unstable

Description

the Search & Relink feature for missing files is incredibly slow for larger libraries, since for every missing entry it walks the library directory again. Extremely noticeable on larger library.

(I noticed this when reorganizing my photos folder from YYYY/ folders to YYYY/MM/DD/ folders, so there were ~11000 moved files)

Expected Behavior

The list of files in the library should be cached between calls to _match_missing_file to speed up unlinked entry Relinking.
In a bodge solution I added a simple member _cache to the Library class, and in _match_missing_file initialize it with the result of os.walk, if not already set.

Steps to Reproduce

  1. Create a library with a lot of entries
  2. Move multiple files to a new directory
  3. Search & Relink the now-missing entries
  4. Observe that between every entry a second or more can pass

Logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: EnhancementNew feature or requestType: QoLA quality of life (QoL) enhancement or suggestion

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions