-
Notifications
You must be signed in to change notification settings - Fork 433
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 binary search for removing elements from Bag #878
Use binary search for removing elements from Bag #878
Conversation
Given that tokens are always added to the end of the array and have a monotonically increasing value, this list is always sorted, so we can use a binary search to improve performance if this list gets large.
@nickoto did you run any tests to validate the performance improvement, and how significant it is? It would be useful to have some metrics. |
Yes; in our particular scenario instruments was showing that for this particular operation in our app that While I can't test this over all workloads, in any situation where many items would be removed from the bag at once e.g. a large teardown, this would be a benefit. In situations where the bag is very tiny the complexity cost is negligible. |
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.
Looks like a good improvement 👍
@mluisbrown Since the runner for ubuntu 18.04 is deprecated we can no longer run the SwiftPM tests for 5.2 as there is no binary release of swift 5.2 on that platform (it only has releases for 16.04 and 18.04). That's why the log is showing a 404 - it fails to download a release that doesn't exist. Not sure why the 5.7 runner was cancelled though -- it looks like it was passing up until it cancelled. |
@nickoto We should drop the 5.2 tests then. I'm not sure if you have the rights to do that. If not let me know and I'll sort it out. |
I can drop it from the yml but I'm not sure if there are other steps required. Update: Yea I don't think I can get any further on my own, I don't even have permission to approve running the workflow @mluisbrown. |
Given that tokens are always added to the end of the array and have a monotonically increasing value, this list is always sorted, so we can use a binary search to improve performance if this list gets large.
Checklist