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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions Rx.NET/Source/System.Reactive.sln
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Reactive.Interfaces"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests.System.Reactive.ApiApprovals", "tests\Tests.System.Reactive.ApiApprovals\Tests.System.Reactive.ApiApprovals.csproj", "{01CCDA6D-4D00-4DF2-82B0-359FD5E0CDC6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Benchmarks.System.Reactive", "benchmarks\Benchmarks.System.Reactive\Benchmarks.System.Reactive.csproj", "{5C7906F6-232E-455C-9269-68EF84F393C9}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Benchmarks", "Benchmarks", "{C8E480ED-B592-4341-A0C9-183E822EB6B9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -330,6 +334,22 @@ Global
{01CCDA6D-4D00-4DF2-82B0-359FD5E0CDC6}.Release|x64.Build.0 = Release|Any CPU
{01CCDA6D-4D00-4DF2-82B0-359FD5E0CDC6}.Release|x86.ActiveCfg = Release|Any CPU
{01CCDA6D-4D00-4DF2-82B0-359FD5E0CDC6}.Release|x86.Build.0 = Release|Any CPU
{5C7906F6-232E-455C-9269-68EF84F393C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5C7906F6-232E-455C-9269-68EF84F393C9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5C7906F6-232E-455C-9269-68EF84F393C9}.Debug|ARM.ActiveCfg = Debug|Any CPU
{5C7906F6-232E-455C-9269-68EF84F393C9}.Debug|ARM.Build.0 = Debug|Any CPU
{5C7906F6-232E-455C-9269-68EF84F393C9}.Debug|x64.ActiveCfg = Debug|Any CPU
{5C7906F6-232E-455C-9269-68EF84F393C9}.Debug|x64.Build.0 = Debug|Any CPU
{5C7906F6-232E-455C-9269-68EF84F393C9}.Debug|x86.ActiveCfg = Debug|Any CPU
{5C7906F6-232E-455C-9269-68EF84F393C9}.Debug|x86.Build.0 = Debug|Any CPU
{5C7906F6-232E-455C-9269-68EF84F393C9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5C7906F6-232E-455C-9269-68EF84F393C9}.Release|Any CPU.Build.0 = Release|Any CPU
{5C7906F6-232E-455C-9269-68EF84F393C9}.Release|ARM.ActiveCfg = Release|Any CPU
{5C7906F6-232E-455C-9269-68EF84F393C9}.Release|ARM.Build.0 = Release|Any CPU
{5C7906F6-232E-455C-9269-68EF84F393C9}.Release|x64.ActiveCfg = Release|Any CPU
{5C7906F6-232E-455C-9269-68EF84F393C9}.Release|x64.Build.0 = Release|Any CPU
{5C7906F6-232E-455C-9269-68EF84F393C9}.Release|x86.ActiveCfg = Release|Any CPU
{5C7906F6-232E-455C-9269-68EF84F393C9}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -348,6 +368,7 @@ Global
{E9BB350B-D4EF-42E1-B4E2-14058AC6809B} = {A0F39260-B8F8-4FCB-9679-0ED917A22BDF}
{A31DDC7E-E883-4DBD-8FB8-D7DFC56059F6} = {A0F39260-B8F8-4FCB-9679-0ED917A22BDF}
{01CCDA6D-4D00-4DF2-82B0-359FD5E0CDC6} = {D324579D-CBE6-4867-8980-D7842C7C45A2}
{5C7906F6-232E-455C-9269-68EF84F393C9} = {C8E480ED-B592-4341-A0C9-183E822EB6B9}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {2483F58F-A8D6-4FFE-A3C1-10F3A36DBE69}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net46</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.10.14" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\tests\Tests.System.Reactive\Tests.System.Reactive.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.

using BenchmarkDotNet.Attributes;
using ReactiveTests.Tests;

namespace Benchmarks.System.Reactive
{
[MemoryDiagnoser]
public class CombineLatestBenchmark
{
private CombineLatestTest _zipTest = new CombineLatestTest();

[Benchmark]
public void CombineLatest_Typical2()
{
_zipTest.CombineLatest_Typical2();
}

[Benchmark]
public void CombineLatest_Typical3()
{
_zipTest.CombineLatest_Typical3();
}

[Benchmark]
public void CombineLatest_Typical4()
{
_zipTest.CombineLatest_Typical4();
}

[Benchmark]
public void CombineLatest_Typical5()
{
_zipTest.CombineLatest_Typical5();
}

[Benchmark]
public void CombineLatest_Typical6()
{
_zipTest.CombineLatest_Typical6();
}

[Benchmark]
public void CombineLatest_Typical7()
{
_zipTest.CombineLatest_Typical7();
}

[Benchmark]
public void CombineLatest_Typical8()
{
_zipTest.CombineLatest_Typical8();
}

[Benchmark]
public void CombineLatest_Typical9()
{
_zipTest.CombineLatest_Typical9();
}

[Benchmark]
public void CombineLatest_Typical10()
{
_zipTest.CombineLatest_Typical10();
}

[Benchmark]
public void CombineLatest_Typical11()
{
_zipTest.CombineLatest_Typical11();
}

[Benchmark]
public void CombineLatest_Typical12()
{
_zipTest.CombineLatest_Typical12();
}

[Benchmark]
public void CombineLatest_Typical13()
{
_zipTest.CombineLatest_Typical13();
}

[Benchmark]
public void CombineLatest_Typical14()
{
_zipTest.CombineLatest_Typical14();
}

[Benchmark]
public void CombineLatest_Typical15()
{
_zipTest.CombineLatest_Typical15();
}

[Benchmark]
public void CombineLatest_Typical16()
{
_zipTest.CombineLatest_Typical16();
}
}
}
23 changes: 23 additions & 0 deletions Rx.NET/Source/benchmarks/Benchmarks.System.Reactive/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.

using System;
using BenchmarkDotNet.Running;

namespace Benchmarks.System.Reactive
{
class Program
{
static void Main()
{
var switcher = new BenchmarkSwitcher(new[] {
typeof(ZipBenchmark),
typeof(CombineLatestBenchmark)
});

switcher.Run();
Console.ReadLine();
}
}
}
135 changes: 135 additions & 0 deletions Rx.NET/Source/benchmarks/Benchmarks.System.Reactive/ZipBenchmark.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.

using BenchmarkDotNet.Attributes;
using ReactiveTests.Tests;

namespace Benchmarks.System.Reactive
{
[MemoryDiagnoser]
public class ZipBenchmark
{
private ZipTest _zipTest = new ZipTest();

[Benchmark]
public void Zip_NAry_Asymmetric()
{
_zipTest.Zip_NAry_Asymmetric();
}

[Benchmark]
public void Zip_NAry_Asymmetric_Selector()
{
_zipTest.Zip_NAry_Asymmetric_Selector();
}

[Benchmark]
public void Zip_NAry_Symmetric()
{
_zipTest.Zip_NAry_Symmetric();
}

[Benchmark]
public void Zip_NAry_Symmetric_Selector()
{
_zipTest.Zip_NAry_Symmetric_Selector();
}

[Benchmark]
public void Zip_NAry_Enumerable_Simple()
{
_zipTest.Zip_NAry_Enumerable_Simple();
}

[Benchmark]
public void Zip_AllCompleted2()
{
_zipTest.Zip_AllCompleted2();
}

[Benchmark]
public void Zip_AllCompleted3()
{
_zipTest.Zip_AllCompleted3();
}

[Benchmark]
public void Zip_AllCompleted4()
{
_zipTest.Zip_AllCompleted4();
}

[Benchmark]
public void Zip_AllCompleted5()
{
_zipTest.Zip_AllCompleted5();
}

[Benchmark]
public void Zip_AllCompleted6()
{
_zipTest.Zip_AllCompleted6();
}

[Benchmark]
public void Zip_AllCompleted7()
{
_zipTest.Zip_AllCompleted7();
}

[Benchmark]
public void Zip_AllCompleted8()
{
_zipTest.Zip_AllCompleted8();
}

[Benchmark]
public void Zip_AllCompleted9()
{
_zipTest.Zip_AllCompleted9();
}

[Benchmark]
public void Zip_AllCompleted10()
{
_zipTest.Zip_AllCompleted10();
}

[Benchmark]
public void Zip_AllCompleted11()
{
_zipTest.Zip_AllCompleted11();
}

[Benchmark]
public void Zip_AllCompleted12()
{
_zipTest.Zip_AllCompleted12();
}

[Benchmark]
public void Zip_AllCompleted13()
{
_zipTest.Zip_AllCompleted13();
}

[Benchmark]
public void Zip_AllCompleted14()
{
_zipTest.Zip_AllCompleted14();
}

[Benchmark]
public void Zip_AllCompleted15()
{
_zipTest.Zip_AllCompleted15();
}

[Benchmark]
public void Zip_AllCompleted16()
{
_zipTest.Zip_AllCompleted16();
}
}
}
Loading