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

Turn localized_function decorator into class #170

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ChanceNCounter
Copy link
Contributor

@ChanceNCounter ChanceNCounter commented Dec 25, 2020

When finished, this should speed up function calls by a considerable margin (in computing terms.) Right now, the function checks the validity of its run_own_code_on parameter every time you call a localized function. This was a tradeoff, but it's particularly egregious considering that the parameter is almost always [None].

By turning the decorator into a class, we can run that check once, when the class is instantiated. It may, however, substantially increase the memory footprint - I haven't checked - which would partially obviate the memory gains from the 0.3 refactor (however, it's still whittled down to just the languages the user is... using...)

@devs-mycroft devs-mycroft added the CLA: Yes Contributor License Agreement exists (see https://github.com/MycroftAI/contributors) label Dec 25, 2020
@ChanceNCounter
Copy link
Contributor Author

This might be better accomplished when the localized modules are crawled at load time, which probably wouldn't affect the memory footprint.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA: Yes Contributor License Agreement exists (see https://github.com/MycroftAI/contributors)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants