Skip to content
Closed
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
25 changes: 25 additions & 0 deletions Rx.NET/ComparisonBenchmarks/ComparisonBenchmarks.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27703.2035
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ComparisonBenchmarks", "ComparisonBenchmarks\ComparisonBenchmarks.csproj", "{50DDB92A-793F-43DF-A84E-1759A235A15D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{50DDB92A-793F-43DF-A84E-1759A235A15D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{50DDB92A-793F-43DF-A84E-1759A235A15D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{50DDB92A-793F-43DF-A84E-1759A235A15D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{50DDB92A-793F-43DF-A84E-1759A235A15D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {643F4DF5-5DD7-4AFB-A95E-29414DDA9379}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
<LangVersion>latest</LangVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.10.14" />
<PackageReference Include="System.Reactive" Version="4.1.0-preview.215" />
</ItemGroup>

</Project>
22 changes: 22 additions & 0 deletions Rx.NET/ComparisonBenchmarks/ComparisonBenchmarks/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// 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 ComparisonBenchmarks
{
internal class Program
{
static void Main(string[] args)
{
var switcher = new BenchmarkSwitcher(new[] {
typeof(RangeBenchmark)
});

switcher.Run();
Console.ReadLine();
}
}
}
25 changes: 25 additions & 0 deletions Rx.NET/ComparisonBenchmarks/ComparisonBenchmarks/RangeBenchmark.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// 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 System.Reactive.Linq;
using System.Threading;
using BenchmarkDotNet.Attributes;

namespace ComparisonBenchmarks
{
[MemoryDiagnoser]
public class RangeBenchmark
{
[Params(1, 10, 100, 1000, 10000, 100000, 1000000)]
public int N;
private int _store;

[Benchmark]
public void Range()
{
Observable.Range(1, N).Subscribe(v => Volatile.Write(ref _store, v));
}
}
}