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

Optimize Bag. #126

Merged
merged 3 commits into from
Nov 27, 2016
Merged

Optimize Bag. #126

merged 3 commits into from
Nov 27, 2016

Conversation

andersio
Copy link
Member

@andersio andersio commented Nov 26, 2016

Test Case 1 & 2
Same environment as in #124

Baseline: master

One Observer: 0.018 sec (10%)
Eight Observers: 0.053 sec (5%)

A custom iterator to mitigate the time spent in protocol witness table for calling the default implementations.

One Observer: 0.012 sec (10%)
Eight Observers: 0.030 sec (6%)

Replace Array with ContiguousArray to avoid swift_bridgeObjectRetain calls in Array subscript getter, despite BagElement being a Swift struct.

One Observer: 0.010 sec (12%)
Eight Observers: 0.020 sec (3%)

Replace the monotonic ID in Bag with ObjectIdentifier.

Apparently no effect on iteration performance.

Copy link
Member

@NachoSoto NachoSoto left a comment

Choose a reason for hiding this comment

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

Nice :shipit:

@andersio andersio merged commit dba767d into master Nov 27, 2016
@andersio andersio deleted the bag-perf branch November 27, 2016 20:54
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.

None yet

2 participants