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

Directory scanning performance improvements #14

Merged
merged 6 commits into from
Apr 10, 2022
Merged

Conversation

AnonymouX47
Copy link
Owner

@AnonymouX47 AnonymouX47 commented Mar 29, 2022

- Add: Adds `.tui.main.UNKNOWN` constant for `scan_dir_*` functions.
- Change: Updates `.tui.main.sort_key_lexi()`.
  - Now accepts `os.DirEntry` or `pathlib.Path` instances instead of strings.
- Change: Updates `.tui.main.scan_dir_entry()`.
  - Now accepts `os.DirEntry` or `pathlib.Path` instances instead of strings for directory entries.
  - Other minor performance optimizations.
- Change: Significantly improves directory entry sorting and scanning performance.
  - Leverages `os.DirEntry`'s stat caching to eliminate system calls by `os.path.isfile()`.
- Change: Updates docstrings.
- Change: Updates `.tui.main.scan_dir()`.
  - Adds *last_entry* and *sort_key* parameters for improved functionality.
  - Replaces `os.listdir()` with `os.scandir()` for significant performance improvements.
  - Now yeilds the entry typecode along with the item tuple.
  - Now yeilds all scanned entries, no matter the type to allow for better control within it's caller.
- Change: Updates docstrings.
- Change: Updates `scan_dir_grid()` and `scan_dir_menu()` in `.tui.main`.
  - Both functions now utilize `.tui.main.scan_dir()`.
- Change: Updates docstrings.
@AnonymouX47 AnonymouX47 added the enhancement New feature / Improvement suggestion or request label Mar 29, 2022
@AnonymouX47 AnonymouX47 added this to the 0.2.0 milestone Mar 29, 2022
- Fix: Fixed `scan_dir_grid()` appending to the grid scan list after the grid has changed.
  - Occured when switching to an empty grid before the current grid scan is done.
  - `scan_dir_grid()` now uses an alias to the grid scan list, which is updated (with `.tui.main._grid_list`) only when changing grids.
- Change: Renamed `.tui.main.grid_list` to `.tui.main._grid_list`.
@AnonymouX47 AnonymouX47 added the tui Related to the image viewer's TUI (Not to be used anymore) label Apr 7, 2022
- Change: Grouped directories before files.
- Change: Removed unnecessary code.
- Change: Updated docstrings and comments.
@AnonymouX47 AnonymouX47 merged commit f14275b into main Apr 10, 2022
@AnonymouX47 AnonymouX47 deleted the directory-scanning branch April 10, 2022 20:36
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature / Improvement suggestion or request tui Related to the image viewer's TUI (Not to be used anymore)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant