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

indices-improve-runtime #88

Merged
merged 1 commit into from
Aug 10, 2024
Merged

Conversation

dolevha
Copy link

@dolevha dolevha commented Jul 24, 2024

It seems that this part of the code takes a lot of processing time with no real reason:
image

@CLAassistant
Copy link

CLAassistant commented Jul 24, 2024

CLA assistant check
All committers have signed the CLA.

Comment on lines -82 to -86
if key in keys:
nextIdx = keys.index(key) + 1

else:
nextIdx = bisect(keys, key)
Copy link
Author

@dolevha dolevha Jul 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keys.index(key) + 1 == bisect(keys, key) when there's 1 item in self.__keys
key in keys - O(n)
keys.index(key) - O(n)
bisect - O(logn)

@lextm lextm added enhancement New feature or request area:pysnmp PySNMP package priority:low Low priority items. labels Jul 25, 2024
@dolevha
Copy link
Author

dolevha commented Jul 30, 2024

Adding another demonstration for the effect it brings - Our SNMP plugin runs twice as fast when applying this change, from an average of 6 hours to an average of 3 hours
image

@lextm lextm merged commit 71b7439 into lextudio:main Aug 10, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:pysnmp PySNMP package enhancement New feature or request priority:low Low priority items.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants