Tags: bonjorno7/3dn-bip
Tags
Optimizations (#48) TL;DR: The PR reduces 1000x calls of load in a loop from a total time of 1.7s to 0.01s (within a VMWare VM). - We removed the thread pool and are using worker queues instead. - Default file type detection is based on extensions now. Magic based detection can still be activated. - Note: The threads and the timer are registered on demand and will be removed automatically when all items have been processed. * Use worker queues instead of a thread pool. * Add support for extension based file type detection. * Add dots to extensions And use pathlib to get the suffix. I think this approach is cleaner. * Use early return if file has no extension This allows the code after it to be tabbed back, which I prefer. Also I changed comments a little. * Add comments to settings.py I think it's good to have this documented. * Rename ImagePreviewCollection event to abort_signal This makes it more obvious what it's for. * Tweaks to thread.py Adjusted some comments, newlines, formatting. We want to catch it if a queue item is somehow not a correct size tuple, so I'm just doing a generic except instead of excepting Empty. Variables that end in `sig` now end in `_signal`. `_read_thread` no longer takes `thread_index`, as it wasn't using it. Swapped the order of the signal check and try block. Removed manual unregister of timer, as returning None is enough. * Rename thread.py to threads.py There are multiple threads. All the other files follow a plural naming scheme. * Bump version to 1.0.9 Co-authored-by: bonjorno7 <[email protected]>
PreviousNext