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

Migrate ZipLongest to Source Generator #162

Merged
merged 8 commits into from
Jan 27, 2023
Merged

Migrate ZipLongest to Source Generator #162

merged 8 commits into from
Jan 27, 2023

Conversation

viceroypenguin
Copy link
Owner

@viceroypenguin viceroypenguin commented Jan 27, 2023

This PR migrates ZipLongest to source generator. This has several advantages:

  • Improves performance of 2-param/3-param versions of ZipLongest
  • Address issues w/ repeated MoveNext calls
  • Add ValueTuple version of ZipLongest

Tests have been updated to acknowledge that different versions do not share common implementations and test each one independently.

Fixes #157
Fixes #160

@codecov-commenter
Copy link

codecov-commenter commented Jan 27, 2023

Codecov Report

Base: 87.19% // Head: 87.32% // Increases project coverage by +0.12% 🎉

Coverage data is based on head (dffdaf4) compared to base (58f587a).
Patch has no changes to coverable lines.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #162      +/-   ##
==========================================
+ Coverage   87.19%   87.32%   +0.12%     
==========================================
  Files         190      188       -2     
  Lines        5122     5040      -82     
  Branches     1191     1177      -14     
==========================================
- Hits         4466     4401      -65     
+ Misses        359      346      -13     
+ Partials      297      293       -4     

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Async version cannot use this technique and cannot be improved further
@viceroypenguin
Copy link
Owner Author

Comparison with morelinq/MoreLINQ#715:

BenchmarkDotNet=v0.13.4, OS=Windows 11 (10.0.22623.1180)
Intel Core i7-1065G7 CPU 1.30GHz, 1 CPU, 8 logical and 4 physical cores
.NET SDK=7.0.102
  [Host] : .NET 7.0.2 (7.0.222.60605), X64 RyuJIT AVX2
Method N Mean Error StdDev Gen0 Gen1 Allocated
SuperLinq 10 208.5 ns 3.21 ns 2.85 ns 0.0439 0.0005 184 B
Pr715 10 255.1 ns 5.03 ns 4.70 ns 0.0420 0.0005 176 B
SuperLinq 50 766.4 ns 14.11 ns 13.20 ns 0.0439 0.0010 184 B
Pr715 50 913.7 ns 8.42 ns 7.88 ns 0.0420 0.0010 176 B
SuperLinq 1000 14,357.7 ns 129.91 ns 121.52 ns 0.0305 0.0153 184 B
Pr715 1000 17,072.3 ns 332.46 ns 408.29 ns 0.0305 0.0305 176 B
SuperLinq 1000000 14,098,844.9 ns 161,667.10 ns 151,223.51 ns - - 214 B
Pr715 1000000 16,713,832.7 ns 313,179.09 ns 292,947.92 ns - - 236 B

See also conversation: morelinq/MoreLINQ#905


@viceroypenguin viceroypenguin merged commit f97c0f2 into master Jan 27, 2023
@viceroypenguin viceroypenguin deleted the ziplongest branch January 27, 2023 04:45
@viceroypenguin viceroypenguin added this to the 4.7.0 milestone Jan 28, 2023
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.

Improve ZipLongest Performance Correct ZipLongest behavior
2 participants