Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request]: Optimize _match_missing_file #610

Open
3 tasks done
Toby222 opened this issue Nov 28, 2024 · 2 comments · May be fixed by #614
Open
3 tasks done

[Feature Request]: Optimize _match_missing_file #610

Toby222 opened this issue Nov 28, 2024 · 2 comments · May be fixed by #614
Labels
Type: Enhancement New feature or request Type: QoL A quality of life (QoL) enhancement or suggestion

Comments

@Toby222
Copy link

Toby222 commented Nov 28, 2024

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

@Toby222 Toby222 added the Type: Bug Something isn't working as intended label Nov 28, 2024
@CyanVoxel
Copy link
Member

I would call this more of a request/need for optimization than a bug since the code is working as intended, but I do agree that this area of the code could really use some optimizing.

@Toby222
Copy link
Author

Toby222 commented Nov 28, 2024

Between feature request and bug, I felt like "doesn't work as it should" fit better than "doesn't work like how I want"
There's no clear category for where to put performance issues over stuff that actually breaks something :^)

Toby222 added a commit to Toby222/TagStudio that referenced this issue Nov 29, 2024
@Toby222 Toby222 linked a pull request Nov 29, 2024 that will close this issue
@CyanVoxel CyanVoxel changed the title [Bug]: _match_missing_file walks library for every missing file [Feature Request]: Optimize _match_missing_file Dec 5, 2024
@CyanVoxel CyanVoxel added Type: Enhancement New feature or request Type: QoL A quality of life (QoL) enhancement or suggestion and removed Type: Bug Something isn't working as intended labels Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement New feature or request Type: QoL A quality of life (QoL) enhancement or suggestion
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants