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

Generator refactor #387

Open
wants to merge 61 commits into
base: whitesource/configure
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
9774aa5
Remove passing-by-reference feature (#335)
aalmada Feb 27, 2021
b64e633
3.0.0-beta41
aalmada Feb 27, 2021
b4c4dcd
NetFabric.Hyperlinq.Abstractions 1.1.0
aalmada Feb 27, 2021
4ddf043
Fix build (#338)
aalmada Feb 28, 2021
87b6c24
Use correct NuGet link (#336)
jzebedee Feb 28, 2021
b2ea96c
Add AsValueEnumerable() for Span<> and ReadOnlySpan<> (#337)
aalmada Feb 28, 2021
cd74cd2
Add missing operator overloads (#339)
aalmada Mar 2, 2021
cf6519a
Code cleanup (#340)
aalmada Mar 3, 2021
4ddac76
Optimize ImmutableArray<> by getting inner array (#341)
aalmada Mar 4, 2021
893396f
Improve coverage (#342)
aalmada Mar 4, 2021
117928f
3.0.0-beta44
aalmada Mar 5, 2021
89c364f
Fix sentence
aalmada Mar 5, 2021
c65f579
Add NetFabric.Hyperlinq.Immutable project (#343)
aalmada Mar 5, 2021
099a2dd
Add bindings for collections in System.Collections.Generic (#344)
aalmada Mar 6, 2021
2459670
Update benchmarks (#345)
aalmada Mar 8, 2021
f41a010
Test Sum() for NaN and Infinity
aalmada Mar 8, 2021
98e83e9
Fix coverage (#346)
aalmada Mar 9, 2021
3aa217c
Code review (#347)
aalmada Mar 9, 2021
587aa01
Add GeneratorBindingsAttribute (#348)
aalmada Mar 13, 2021
a4baad3
Upgrade to .NET 6.0 (#349)
aalmada Mar 13, 2021
cc437fc
Fix benchmarks
aalmada Mar 14, 2021
0fc76de
Fix Where for ValueEnumerable
aalmada Mar 14, 2021
f4146ed
Test NetFabric.Hyperlinq.Immutable (#350)
aalmada Mar 15, 2021
6199b1a
Refactor handling of IReadOnlyList (#351)
aalmada Mar 15, 2021
4e90475
Benchmark fixes (#352)
aalmada Mar 17, 2021
2e637e0
Fix conversion and Sum for ReadOnlyList
aalmada Mar 18, 2021
7c97136
Update benchmark results
aalmada Mar 19, 2021
a86fad2
Add ValueMemoryOwner (#355)
aalmada May 12, 2021
028db60
Update StructLinq to 0.26.0 (#354)
reegeek May 12, 2021
a8e30a5
Refactor handling of lists (#356)
aalmada May 18, 2021
935fb60
Refactor indexer bounds checking (#357)
aalmada May 18, 2021
daab08e
Add array.ToArray() benchmarks (#358)
aalmada May 30, 2021
8b57da1
Use enumerator instead of indexer
aalmada May 23, 2021
01017e1
Update benchmark results
aalmada Jun 5, 2021
e8ce7c9
Fix casts to ICollection
aalmada Jun 5, 2021
d5eb373
Update benchmark results
aalmada Jun 6, 2021
4d75ba9
Update benchmark results for .NET 6.0 Preview 5
aalmada Jun 18, 2021
193789c
Array iteration benchmarks
aalmada Jun 20, 2021
9bb2afa
Use Length - 1
aalmada Jun 20, 2021
6a7e3e3
Use Length - 1
aalmada Jun 20, 2021
e78d541
Add Vector benchmarks
aalmada Jun 21, 2021
e3c97cf
Cleanup
aalmada Jun 26, 2021
3c29ee4
Improve performance of Sum() (#370)
aalmada Jun 28, 2021
2a8f961
Add Count(predicate) (#363)
aalmada Jul 1, 2021
59d8d40
Fix Contains() and ToArray() (#376)
aalmada Sep 1, 2021
647af4c
Review ToArray() (#378)
aalmada Sep 5, 2021
c3fa93a
Review ToArray on enumerables (#379)
aalmada Sep 6, 2021
d12a525
Add Lease<> type (#380)
aalmada Sep 9, 2021
5eee317
Fix SingleAsync() (#381)
aalmada Sep 11, 2021
efaaa5d
Bump version to 3.0.0-beta46 (#382)
aalmada Sep 14, 2021
1878308
Make Lease<> constructor public (#383)
aalmada Sep 23, 2021
d62f946
3.0.0-beta47
aalmada Sep 23, 2021
40a2e76
Make ArrayPoolExtensions public (#384)
aalmada Sep 23, 2021
9abf381
Remove NoInliningAttribute for Throw methods (#385)
aalmada Sep 27, 2021
d6ed2e4
Refactor the source generator to be public
aalmada Jul 7, 2021
2c13b9b
Remove Obsolete
aalmada Sep 23, 2021
013b6e6
Fix build
aalmada Sep 24, 2021
868abd6
Refactor CodeBuilder
aalmada Sep 29, 2021
e02c80f
Fix build
aalmada Oct 4, 2021
dc1c008
Refactor CodeBuilder
aalmada Oct 6, 2021
60a3456
Fix code generation
aalmada Oct 8, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
22 changes: 11 additions & 11 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ indent_style = space
tab_width = 4

# New line preferences
end_of_line = crlf
# end_of_line = crlf
insert_final_newline = false

#### .NET Coding Conventions ####
Expand Down Expand Up @@ -58,7 +58,7 @@ dotnet_style_prefer_is_null_check_over_reference_equality_method = true:error
dotnet_style_readonly_field = true:error

# Parameter preferences
dotnet_code_quality_unused_parameters = all:error
dotnet_code_quality_unused_parameters = all:warning

#### C# Coding Conventions ####

Expand All @@ -68,14 +68,14 @@ csharp_style_var_for_built_in_types = true:error
csharp_style_var_when_type_is_apparent = true:error

# Expression-bodied members
csharp_style_expression_bodied_accessors = true:error
csharp_style_expression_bodied_constructors = true:error
csharp_style_expression_bodied_indexers = true:error
csharp_style_expression_bodied_lambdas = true:error
csharp_style_expression_bodied_local_functions = true:error
csharp_style_expression_bodied_methods = true:error
csharp_style_expression_bodied_operators = true:error
csharp_style_expression_bodied_properties = true:error
csharp_style_expression_bodied_accessors =true:warning
csharp_style_expression_bodied_constructors =true:warning
csharp_style_expression_bodied_indexers =true:warning
csharp_style_expression_bodied_lambdas =true:warning
csharp_style_expression_bodied_local_functions =true:warning
csharp_style_expression_bodied_methods =true:warning
csharp_style_expression_bodied_operators =true:warning
csharp_style_expression_bodied_properties =true:warning

# Pattern matching preferences
csharp_style_pattern_matching_over_as_with_null_check = true:error
Expand All @@ -101,7 +101,7 @@ csharp_style_pattern_local_over_anonymous_function = true:error
csharp_style_prefer_index_operator = true:warning
csharp_style_prefer_range_operator = true:warning
csharp_style_throw_expression = true:error
csharp_style_unused_value_assignment_preference = discard_variable:error
csharp_style_unused_value_assignment_preference =discard_variable:warning
csharp_style_unused_value_expression_statement_preference = discard_variable:error

# 'using' directive preferences
Expand Down
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto
* text eol=lf

###############################################################################
# Set default behavior for command prompt diff.
Expand Down
15 changes: 6 additions & 9 deletions .github/workflows/dotnetcore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,21 @@ jobs:
- name: Check out repository
uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1.7.2
uses: actions/setup-dotnet@v1
with:
dotnet-version: '5.0.x'
dotnet-version: '6.0.x'
include-prerelease: true
- name: Test source generator
run: dotnet test ./NetFabric.Hyperlinq.SourceGenerator.UnitTests/NetFabric.Hyperlinq.SourceGenerator.UnitTests.csproj
run: dotnet test ./NetFabric.Hyperlinq.UnitTests/NetFabric.Hyperlinq.UnitTests.csproj
- name: Build solution
run: dotnet build
- name: Tests and coverage
run: dotnet test ./NetFabric.Hyperlinq.UnitTests/NetFabric.Hyperlinq.UnitTests.csproj -f:net5.0 -c:Release --collect:"XPlat Code Coverage" --settings coverlet.runsettings
- name: Get path to lcov file
id: get_lcov_path
shell: bash
run: printf '::set-output name=lcov_path::%s\n' ./NetFabric.Hyperlinq.UnitTests/TestResults/*/coverage.info
run: dotnet test ./NetFabric.Hyperlinq.Core.UnitTests/NetFabric.Hyperlinq.Core.UnitTests.csproj -f:net6.0 -p:CollectCoverage=true -p:CoverletOutputFormat=lcov -p:CoverletOutput=TestResults/
- name: Publish coverage report to coveralls.io
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ${{ steps.get_lcov_path.outputs.lcov_path }}
path-to-lcov: ./NetFabric.Hyperlinq.Core.UnitTests/TestResults/coverage.net6.0.info



Expand Down
29 changes: 29 additions & 0 deletions Benchmarks/AggressiveInliningBenchmarks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
## AggressiveInliningBenchmarks

### Source
[AggressiveInliningBenchmarks.cs](../NetFabric.Hyperlinq.Benchmarks/Benchmarks/AggressiveInliningBenchmarks.cs)

### References:
- Linq: 6.0.0-preview.5.21301.5
- System.Linq.Async: [5.0.0](https://www.nuget.org/packages/System.Linq.Async/5.0.0)
- System.Interactive: [5.0.0](https://www.nuget.org/packages/System.Interactive/5.0.0)
- System.Interactive.Async: [5.0.0](https://www.nuget.org/packages/System.Interactive.Async/5.0.0)
- StructLinq: [0.26.0](https://www.nuget.org/packages/StructLinq/0.26.0)
- NetFabric.Hyperlinq: [3.0.0-beta44](https://www.nuget.org/packages/NetFabric.Hyperlinq/3.0.0-beta44)

### Results:
``` ini

BenchmarkDotNet=v0.13.0.1555-nightly, OS=Windows 10.0.19043.1055 (21H1/May2021Update)
Intel Core i7-7567U CPU 3.50GHz (Kaby Lake), 1 CPU, 4 logical and 2 physical cores
.NET SDK=6.0.100-preview.5.21302.13
[Host] : .NET 6.0.0 (6.0.21.30105), X64 RyuJIT
Job-UNTOJZ : .NET 6.0.0 (6.0.21.30105), X64 RyuJIT

Runtime=.NET 6.0

```
| Method | Count | Mean | Error | StdDev | Ratio | Gen 0 | Gen 1 | Gen 2 | Allocated |
|------------------- |------ |---------:|--------:|--------:|------:|------:|------:|------:|----------:|
| Baseline | 1000 | 545.7 ns | 1.04 ns | 0.97 ns | 1.00 | - | - | - | - |
| AggressiveInlining | 1000 | 544.8 ns | 1.32 ns | 1.24 ns | 1.00 | - | - | - | - |
80 changes: 39 additions & 41 deletions Benchmarks/AllBenchmarks.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,52 +4,50 @@
[AllBenchmarks.cs](../NetFabric.Hyperlinq.Benchmarks/Benchmarks/AllBenchmarks.cs)

### References:
- Linq: 5.0.0-preview.7.20364.11
- System.Linq.Async: [4.1.1](https://www.nuget.org/packages/System.Linq.Async/4.1.1)
- System.Interactive: [4.1.1](https://www.nuget.org/packages/System.Interactive/4.1.1)
- System.Interactive.Async: [4.1.1](https://www.nuget.org/packages/System.Interactive.Async/4.1.1)
- StructLinq: [0.19.2](https://www.nuget.org/packages/StructLinq/0.19.2)
- NetFabric.Hyperlinq: [3.0.0-beta26](https://www.nuget.org/packages/NetFabric.Hyperlinq/3.0.0-beta26)
- Linq: 6.0.0-preview.5.21301.5
- System.Linq.Async: [5.0.0](https://www.nuget.org/packages/System.Linq.Async/5.0.0)
- System.Interactive: [5.0.0](https://www.nuget.org/packages/System.Interactive/5.0.0)
- System.Interactive.Async: [5.0.0](https://www.nuget.org/packages/System.Interactive.Async/5.0.0)
- StructLinq: [0.26.0](https://www.nuget.org/packages/StructLinq/0.26.0)
- NetFabric.Hyperlinq: [3.0.0-beta44](https://www.nuget.org/packages/NetFabric.Hyperlinq/3.0.0-beta44)

### Results:
``` ini

BenchmarkDotNet=v0.12.1, OS=Windows 10.0.19042
BenchmarkDotNet=v0.13.0.1555-nightly, OS=Windows 10.0.19043.1055 (21H1/May2021Update)
Intel Core i7-7567U CPU 3.50GHz (Kaby Lake), 1 CPU, 4 logical and 2 physical cores
.NET Core SDK=5.0.100-preview.7.20366.6
[Host] : .NET Core 5.0.0 (CoreCLR 5.0.20.36411, CoreFX 5.0.20.36411), X64 RyuJIT
.NET Core 5.0 : .NET Core 5.0.0 (CoreCLR 5.0.20.36411, CoreFX 5.0.20.36411), X64 RyuJIT
.NET SDK=6.0.100-preview.5.21302.13
[Host] : .NET 6.0.0 (6.0.21.30105), X64 RyuJIT
Job-UNTOJZ : .NET 6.0.0 (6.0.21.30105), X64 RyuJIT

Job=.NET Core 5.0 Runtime=.NET Core 5.0
Runtime=.NET 6.0

```
| Method | Categories | Count | Mean | Error | StdDev | Ratio | RatioSD | Gen 0 | Gen 1 | Gen 2 | Allocated |
|------------------------------------ |-------------------------- |------ |-----------:|---------:|---------:|------:|--------:|-------:|------:|------:|----------:|
| Linq_Array | Array | 100 | 528.0 ns | 5.57 ns | 4.94 ns | 1.00 | 0.00 | 0.0153 | - | - | 32 B |
| Hyperlinq_Array | Array | 100 | 191.4 ns | 1.67 ns | 1.56 ns | 0.36 | 0.00 | - | - | - | - |
| Hyperlinq_Span | Array | 100 | 166.2 ns | 1.88 ns | 1.76 ns | 0.32 | 0.00 | - | - | - | - |
| Hyperlinq_Memory | Array | 100 | 215.8 ns | 2.12 ns | 1.99 ns | 0.41 | 0.00 | - | - | - | - |
| | | | | | | | | | | | |
| Linq_Enumerable_Value | Enumerable_Value | 100 | 737.5 ns | 6.24 ns | 5.84 ns | 1.00 | 0.00 | 0.0153 | - | - | 32 B |
| Hyperlinq_Enumerable_Value | Enumerable_Value | 100 | 199.4 ns | 2.30 ns | 1.92 ns | 0.27 | 0.00 | - | - | - | - |
| | | | | | | | | | | | |
| Linq_Collection_Value | Collection_Value | 100 | 741.2 ns | 6.95 ns | 6.50 ns | 1.00 | 0.00 | 0.0153 | - | - | 32 B |
| Hyperlinq_Collection_Value | Collection_Value | 100 | 233.7 ns | 3.46 ns | 3.24 ns | 0.32 | 0.00 | - | - | - | - |
| | | | | | | | | | | | |
| Linq_List_Value | List_Value | 100 | 737.0 ns | 6.21 ns | 5.80 ns | 1.00 | 0.00 | 0.0153 | - | - | 32 B |
| Hyperlinq_List_Value | List_Value | 100 | 401.4 ns | 3.81 ns | 3.18 ns | 0.54 | 0.01 | - | - | - | - |
| | | | | | | | | | | | |
| Linq_AsyncEnumerable_Value | AsyncEnumerable_Value | 100 | 2,176.1 ns | 25.71 ns | 21.47 ns | 1.00 | 0.00 | 0.0191 | - | - | 40 B |
| Hyperlinq_AsyncEnumerable_Value | AsyncEnumerable_Value | 100 | 331.5 ns | 3.55 ns | 3.32 ns | 0.15 | 0.00 | 0.0191 | - | - | 40 B |
| | | | | | | | | | | | |
| Linq_Enumerable_Reference | Enumerable_Reference | 100 | 570.6 ns | 5.53 ns | 5.18 ns | 1.00 | 0.00 | 0.0153 | - | - | 32 B |
| Hyperlinq_Enumerable_Reference | Enumerable_Reference | 100 | 523.1 ns | 4.70 ns | 4.40 ns | 0.92 | 0.01 | 0.0153 | - | - | 32 B |
| | | | | | | | | | | | |
| Linq_Collection_Reference | Collection_Reference | 100 | 572.8 ns | 5.56 ns | 5.20 ns | 1.00 | 0.00 | 0.0153 | - | - | 32 B |
| Hyperlinq_Collection_Reference | Collection_Reference | 100 | 520.5 ns | 7.43 ns | 6.59 ns | 0.91 | 0.02 | 0.0153 | - | - | 32 B |
| | | | | | | | | | | | |
| Linq_List_Reference | List_Reference | 100 | 572.2 ns | 3.72 ns | 3.11 ns | 1.00 | 0.00 | 0.0153 | - | - | 32 B |
| Hyperlinq_List_Reference | List_Reference | 100 | 376.9 ns | 2.50 ns | 2.22 ns | 0.66 | 0.00 | - | - | - | - |
| | | | | | | | | | | | |
| Linq_AsyncEnumerable_Reference | AsyncEnumerable_Reference | 100 | 2,114.6 ns | 19.98 ns | 18.69 ns | 1.00 | 0.00 | 0.0191 | - | - | 40 B |
| Hyperlinq_AsyncEnumerable_Reference | AsyncEnumerable_Reference | 100 | 358.6 ns | 2.02 ns | 1.88 ns | 0.17 | 0.00 | 0.0305 | - | - | 64 B |
| Method | Categories | Count | Mean | Error | StdDev | Ratio | Gen 0 | Gen 1 | Gen 2 | Allocated |
|------------------------------------ |-------------------------- |------ |-----------:|--------:|--------:|------:|-------:|------:|------:|----------:|
| Linq_Array | Array | 100 | 594.4 ns | 2.87 ns | 2.24 ns | 1.00 | 0.0153 | - | - | 32 B |
| Hyperlinq_Array | Array | 100 | 193.1 ns | 0.79 ns | 0.66 ns | 0.32 | - | - | - | - |
| | | | | | | | | | | |
| Linq_Enumerable_Value | Enumerable_Value | 100 | 778.5 ns | 2.27 ns | 1.77 ns | 1.00 | 0.0153 | - | - | 32 B |
| Hyperlinq_Enumerable_Value | Enumerable_Value | 100 | 226.0 ns | 1.07 ns | 0.95 ns | 0.29 | - | - | - | - |
| | | | | | | | | | | |
| Linq_Collection_Value | Collection_Value | 100 | 792.8 ns | 3.27 ns | 2.73 ns | 1.00 | 0.0153 | - | - | 32 B |
| Hyperlinq_Collection_Value | Collection_Value | 100 | 228.5 ns | 1.08 ns | 1.01 ns | 0.29 | - | - | - | - |
| | | | | | | | | | | |
| Linq_List_Value | List_Value | 100 | 795.6 ns | 3.95 ns | 3.69 ns | 1.00 | 0.0153 | - | - | 32 B |
| Hyperlinq_List_Value | List_Value | 100 | 783.9 ns | 8.51 ns | 7.10 ns | 0.99 | 0.0153 | - | - | 32 B |
| | | | | | | | | | | |
| Linq_AsyncEnumerable_Value | AsyncEnumerable_Value | 100 | 1,713.6 ns | 7.04 ns | 5.88 ns | 1.00 | 0.0153 | - | - | 32 B |
| Hyperlinq_AsyncEnumerable_Value | AsyncEnumerable_Value | 100 | 248.1 ns | 1.01 ns | 0.95 ns | 0.14 | - | - | - | - |
| | | | | | | | | | | |
| Linq_Enumerable_Reference | Enumerable_Reference | 100 | 787.9 ns | 3.26 ns | 2.89 ns | 1.00 | 0.0153 | - | - | 32 B |
| Hyperlinq_Enumerable_Reference | Enumerable_Reference | 100 | 779.3 ns | 6.61 ns | 5.86 ns | 0.99 | 0.0153 | - | - | 32 B |
| | | | | | | | | | | |
| Linq_Collection_Reference | Collection_Reference | 100 | 746.7 ns | 2.31 ns | 2.16 ns | 1.00 | 0.0153 | - | - | 32 B |
| Hyperlinq_Collection_Reference | Collection_Reference | 100 | 806.8 ns | 3.82 ns | 3.19 ns | 1.08 | 0.0153 | - | - | 32 B |
| | | | | | | | | | | |
| Linq_List_Reference | List_Reference | 100 | 749.4 ns | 5.37 ns | 4.49 ns | 1.00 | 0.0153 | - | - | 32 B |
| Hyperlinq_List_Reference | List_Reference | 100 | 728.0 ns | 1.89 ns | 1.58 ns | 0.97 | 0.0153 | - | - | 32 B |
| | | | | | | | | | | |
| Linq_AsyncEnumerable_Reference | AsyncEnumerable_Reference | 100 | 1,712.4 ns | 6.90 ns | 6.45 ns | 1.00 | 0.0153 | - | - | 32 B |
| Hyperlinq_AsyncEnumerable_Reference | AsyncEnumerable_Reference | 100 | 296.8 ns | 5.57 ns | 4.94 ns | 0.17 | 0.0153 | - | - | 32 B |