-
Notifications
You must be signed in to change notification settings - Fork 8
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
Refactor channel search functionality in tdm_loader
#28
Conversation
The previous implementation of the channel search function in the `tdm_loader.py` was refactored. Search now matches channels directly without set generation and updates retrieval with more efficient lookups. The modification updates the testing to reflect the changes in the returned search results as well. Before the refactor searching throe 22000 channels took 6.5min and after it took 0.08s Also the test has changed to be similar when searching for "", all channels should be returned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for yet another fix :)
It's looking all good but I suggest to use a caching function. It's a bit more pythonic and easier to understand for people reading the code (and is essentially doing what you did "manually").
Co-authored-by: Florian Dobener <github@schroedingerscat.org>
Co-authored-by: Florian Dobener <github@schroedingerscat.org>
Co-authored-by: Florian Dobener <github@schroedingerscat.org>
Co-authored-by: Florian Dobener <github@schroedingerscat.org>
Co-authored-by: Florian Dobener <github@schroedingerscat.org>
Co-authored-by: Florian Dobener <github@schroedingerscat.org>
A cache decorator is introduced for the `get_channels` function to speed up repeated lookups, replacing the previous, dictionary lookup.
Thanks, I have never used the cache tool before, I knew about it, but never used it. But should the function be privat? |
Thanks for the changes!
Yes, I think this would be good. You can also nest it into the |
The public `get_channels` function is renamed to the private method `_get_channels` in 'tdm_loader.py'. This is due to internal use only, to provide more clarity and prevent unintended external access.
The method name "get_channels" has been corrected to "_get_channels" in the 'tdm_loader.py' file. The change was necessitated by the requirement for the method to be private, hence the underscore, as it's only meant for internal use, preventing unintended external access.
Should the channel search also use the description of the channel when searching? Or should that be a different function. |
I think it's better to have a separate function for it or at least a function parameter which defaults to false. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thank you for the contribution :)
The previous implementation of the channel search function in the
tdm_loader.py
was refactored. Search now matches channels directly without set generation and updates retrieval with more efficient lookups. The modification updates the testing to reflect the changes in the returned search results as well.Before the refactor searching throe 22000 channels took 6.5min and after it took 0.08s
Also the test has changed to be similar to group_search when searching for "", all channels should be returned.