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

Less allocations in CombineLatest #637

Merged
merged 3 commits into from
Jun 22, 2018
Merged

Less allocations in CombineLatest #637

merged 3 commits into from
Jun 22, 2018

Conversation

danielcweber
Copy link
Collaborator

BenchmarkDotNet-results:

Original:

                  Method |      Mean |     Error |    StdDev |   Gen 0 | Allocated |
------------------------ |----------:|----------:|----------:|--------:|----------:|
  CombineLatest_Typical2 |  7.782 us | 0.1516 us | 0.1418 us | 18.1732 |  37.49 KB |
  CombineLatest_Typical3 | 10.117 us | 0.1421 us | 0.1259 us | 19.4092 |  39.94 KB |
  CombineLatest_Typical4 | 12.379 us | 0.1666 us | 0.1558 us | 20.4010 |  41.96 KB |
  CombineLatest_Typical5 | 14.565 us | 0.1809 us | 0.1692 us | 21.2708 |  43.91 KB |
  CombineLatest_Typical6 | 17.205 us | 0.3376 us | 0.4019 us | 22.3083 |  45.91 KB |
  CombineLatest_Typical7 | 19.341 us | 0.3281 us | 0.3069 us | 23.4375 |  48.17 KB |
  CombineLatest_Typical8 | 21.923 us | 0.3786 us | 0.3541 us | 24.3835 |  50.16 KB |
  CombineLatest_Typical9 | 24.930 us | 0.3194 us | 0.2988 us | 25.3601 |  52.18 KB |
 CombineLatest_Typical10 | 26.821 us | 0.2250 us | 0.2105 us | 26.3062 |  54.16 KB |
 CombineLatest_Typical11 | 29.256 us | 0.6369 us | 0.5646 us | 27.3438 |  56.15 KB |
 CombineLatest_Typical12 | 30.725 us | 0.6072 us | 0.5679 us | 28.3203 |  58.15 KB |
 CombineLatest_Typical13 | 34.625 us | 0.5876 us | 0.5209 us | 29.2969 |  60.14 KB |
 CombineLatest_Typical14 | 37.387 us | 0.9611 us | 0.8520 us | 30.2734 |  62.13 KB |
 CombineLatest_Typical15 | 39.565 us | 0.7561 us | 0.7072 us | 31.4941 |  64.66 KB |
 CombineLatest_Typical16 | 42.625 us | 0.4401 us | 0.3902 us | 32.4097 |  66.64 KB |


Less allocations:

                  Method |      Mean |     Error |    StdDev |   Gen 0 | Allocated |
------------------------ |----------:|----------:|----------:|--------:|----------:|
  CombineLatest_Typical2 |  7.994 us | 0.1915 us | 0.4284 us | 18.1732 |  37.49 KB |
  CombineLatest_Typical3 | 10.390 us | 0.2061 us | 0.2205 us | 19.4092 |  39.86 KB |
  CombineLatest_Typical4 | 12.876 us | 0.1537 us | 0.1438 us | 20.4010 |  41.84 KB |
  CombineLatest_Typical5 | 15.253 us | 0.1810 us | 0.1693 us | 21.2708 |  43.79 KB |
  CombineLatest_Typical6 | 17.808 us | 0.4094 us | 0.5324 us | 22.2168 |  45.76 KB |
  CombineLatest_Typical7 | 20.226 us | 0.3981 us | 0.4088 us | 23.2544 |     48 KB |
  CombineLatest_Typical8 | 22.777 us | 0.3718 us | 0.3478 us | 24.3835 |  49.97 KB |
  CombineLatest_Typical9 | 25.220 us | 0.1248 us | 0.0974 us | 25.2991 |  51.96 KB |
 CombineLatest_Typical10 | 28.183 us | 0.4242 us | 0.3968 us | 26.3062 |  53.95 KB |
 CombineLatest_Typical11 | 30.336 us | 0.3151 us | 0.2793 us | 27.1912 |  55.92 KB |
 CombineLatest_Typical12 | 32.899 us | 0.6381 us | 0.7349 us | 28.1372 |   57.9 KB |
 CombineLatest_Typical13 | 36.574 us | 0.6383 us | 0.5971 us | 29.1138 |  59.84 KB |
 CombineLatest_Typical14 | 38.209 us | 0.5974 us | 0.5588 us | 30.0903 |   61.8 KB |
 CombineLatest_Typical15 | 40.917 us | 0.5025 us | 0.4196 us | 31.2500 |  64.29 KB |
 CombineLatest_Typical16 | 43.664 us | 0.8243 us | 0.7711 us | 32.2266 |  66.32 KB |

@danielcweber danielcweber changed the title Less allocations in combine latest Less allocations in CombineLatest Jun 21, 2018
@glennawatson
Copy link

glennawatson commented Jun 22, 2018

Be curious if it'd be worthwhile having tests running over a much larger sample. Like 10000 instead of like 16. I see the trend though, slight decrease in speed, decrease in allocs.

@danielcweber
Copy link
Collaborator Author

The overload takes a max of 16 observables. You can combine more observables but that will be handled by some other code, not in the scope of the optimizations of this PR.

@danielcweber
Copy link
Collaborator Author

Do you have an idea what would make speed decrease slightly? There wasn't any additional workload introduced.

@danielcweber danielcweber merged commit fbce075 into dotnet:master Jun 22, 2018
@danielcweber danielcweber deleted the LessAllocationsInCombineLatest branch June 22, 2018 15:07
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