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

use static_level_no in explicit methods #743

Merged
merged 2 commits into from
Nov 12, 2022

Conversation

tds333
Copy link
Contributor

@tds333 tds333 commented Nov 5, 2022

Small performance improvement if no logging is needed.
Also use the default static_level_no in known methods. Defaults can be used because changes are not allowed.

tds333 and others added 2 commits November 12, 2022 12:53
use static_level_no to return early if no handling is needed
@Delgan Delgan force-pushed the performance_improvements branch from 7109770 to 20ad5ca Compare November 12, 2022 11:54
@Delgan Delgan merged commit 253e967 into Delgan:master Nov 12, 2022
@Delgan
Copy link
Owner

Delgan commented Nov 12, 2022

Thanks for the improvement, @tds333!
Level severity can't be changed since #209, indeed, and I didn't realize it meant we could also early exit the function without the (somewhat expensive) getframe() call.

Actually, your PR made me realize I could also generalize this improvement to the .log() function and also remove the static_level_no argument for simplification. See a37d2d1.
It implies an additional dict lookup (error-free) compared to your solution, but I think it's totally negligible (and probably faster for the case without early exit).

@tds333
Copy link
Contributor Author

tds333 commented Nov 13, 2022

I had the same in mind. But then decided to submit only a minimal change.
I think the refactoring improves and simplifies the code. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants