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

Convert JIT/Performance to a merged test group #85851

Merged
merged 6 commits into from
May 12, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,25 @@ contributed by Marek Safar
*/

using System;
using System.Runtime.CompilerServices;
using Xunit;

namespace BenchmarksGame
{
public class BinaryTrees_2
{
const int minDepth = 4;

public static int Main(String[] args)
[Fact]
public static int TestEntryPoint()
{
int n = 0;
if (args.Length > 0) n = Int32.Parse(args[0]);
return Test(null);
}

[MethodImpl(MethodImplOptions.NoInlining)]
public static int Test(int? arg)
{
int n = arg ?? 0;

int check = Bench(n, true);
int expected = 4398;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<!-- Needed for GCStressIncompatible -->
<RequiresProcessIsolation>true</RequiresProcessIsolation>
<GCStressIncompatible>true</GCStressIncompatible>
</PropertyGroup>
<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,24 @@ minor improvements by Alex Yakunin
using System;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using Xunit;

namespace BenchmarksGame
{
public class BinaryTrees_5
{
public const int MinDepth = 4;

public static int Main(string[] args)
[Fact]
public static int TestEntryPoint()
{
var n = args.Length == 0 ? 0 : int.Parse(args[0]);
return Test(null);
}

[MethodImpl(MethodImplOptions.NoInlining)]
public static int Test(int? arg)
{
var n = arg ?? 0;

int check = Bench(n, true);
int expected = 4398;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<!-- Needed for GCStressIncompatible -->
<RequiresProcessIsolation>true</RequiresProcessIsolation>
<GCStressIncompatible>true</GCStressIncompatible>
</PropertyGroup>
<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using System;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using Xunit;
//using BenchmarkDotNet.Attributes;
//using MicroBenchmarks;

Expand All @@ -33,9 +34,16 @@ public class BinaryTrees_6
// 21 is used in official numbers; about 7.8s
const int N = 18;

public static int Main(string[] args)
[Fact]
public static int TestEntryPoint()
{
var n = args.Length == 0 ? 0 : int.Parse(args[0]);
return Test(null);
}

[MethodImpl(MethodImplOptions.NoInlining)]
public static int Test(int? arg)
{
var n = arg ?? 0;
int check = Bench(n, true);

const int expected = 4398;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<!-- Needed for GCStressIncompatible -->
<RequiresProcessIsolation>true</RequiresProcessIsolation>
<GCStressIncompatible>true</GCStressIncompatible>
</PropertyGroup>
<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
*/

using System;
using System.Runtime.CompilerServices;
using Xunit;

namespace BenchmarksGame
{
Expand Down Expand Up @@ -71,9 +73,16 @@ public int[] fannkuch(int n)
} while (true);
}

static int Main(string[] args)
[Fact]
public static int TestEntryPoint()
{
int n = (args.Length > 0) ? Int32.Parse(args[0]) : 7;
return Test(null);
}

[MethodImpl(MethodImplOptions.NoInlining)]
static int Test(int? arg)
{
int n = arg ?? 7;
var fr2 = new FannkuchRedux_2();
var pf = fr2.fannkuch(n);
Console.Write("{0}\nPfannkuchen({1}) = {2}\n", pf[0], n, pf[1]);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
</PropertyGroup>
<PropertyGroup>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ parallel and small optimisations by Anthony Lloyd
using System;
using System.Threading;
using System.Runtime.CompilerServices;
using Xunit;

namespace BenchmarksGame
{
Expand Down Expand Up @@ -98,9 +99,16 @@ static void run(int n, int taskId, int taskSize)
maxFlips[taskId] = maxflips;
}

public static int Main(string[] args)
[Fact]
public static int TestEntryPoint()
{
int n = args.Length > 0 ? int.Parse(args[0]) : 7;
return Test(null);
}

[MethodImpl(MethodImplOptions.NoInlining)]
static int Test(int? arg)
{
int n = arg ?? 7;
int sum = Bench(n, true);

int expected = 16;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
</PropertyGroup>
<PropertyGroup>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using System.Linq;
using System.Runtime.CompilerServices;
using System.Threading;
using Xunit;
//using BenchmarkDotNet.Attributes;
//using MicroBenchmarks;

Expand All @@ -23,9 +24,16 @@ namespace BenchmarksGame
//[BenchmarkCategory(Categories.Runtime, Categories.BenchmarksGame, Categories.JIT)]
public unsafe class FannkuchRedux_9
{
public static int Main(string[] args)
[Fact]
public static int TestEntryPoint()
{
int n = args.Length > 0 ? int.Parse(args[0]) : 7;
return Test(null);
}

[MethodImpl(MethodImplOptions.NoInlining)]
static int Test(int? arg)
{
int n = arg ?? 7;
int sum = Bench(n, true);

int expected = 228;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
</PropertyGroup>
<PropertyGroup>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ modified by Josh Goldfoot (fasta-repeat buffering)
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Xunit;

namespace BenchmarksGame
{
Expand All @@ -35,9 +36,16 @@ public class Fasta_1
const int IC = 29573;
static int seed = 42;

public static int Main(string[] args)
[Fact]
public static int TestEntryPoint()
{
int n = args.Length > 0 ? Int32.Parse(args[0]) : 1000;
return Test(null);
}

[MethodImpl(MethodImplOptions.NoInlining)]
static int Test(int? arg)
{
int n = arg ?? 1000;

Bench(n, true);
return 100;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
</PropertyGroup>
<PropertyGroup>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,24 @@ optimizations by Alp Toker <alp@atoker.com>

using System;
using System.IO;
using System.Runtime.CompilerServices;
using System.Text;
using Xunit;

namespace BenchmarksGame
{
public class Fasta_2
{
static int Main(string[] args)
[Fact]
public static int TestEntryPoint()
{
int n = args.Length > 0 ? Int32.Parse(args[0]) : 1000;
return Test(null);
}

[MethodImpl(MethodImplOptions.NoInlining)]
static int Test(int? arg)
{
int n = arg ?? 1000;

Bench(n, true);
return 100;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
</PropertyGroup>
<PropertyGroup>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using System.IO;
using System.Collections.Generic;
using System.Text;
using Xunit;

namespace BenchmarksGame
{
Expand Down Expand Up @@ -81,7 +82,8 @@ public static byte[] GetBytes(this List<string> input)
public class KNucleotide_1
{

public static int Main()
[Fact]
public static int TestEntryPoint()
{
var helpers = new TestHarnessHelpers(bigInput: false);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
</PropertyGroup>
<PropertyGroup>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ submitted by Josh Goldfoot
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Runtime.CompilerServices;
using Xunit;

namespace BenchmarksGame
{
Expand Down Expand Up @@ -252,7 +253,8 @@ static string writeCount(Dictionary<long, Wrapper> dictionary, string fragment,
return string.Concat(n.ToString(), "\t", fragment);
}

public static int Main()
[Fact]
public static int TestEntryPoint()
{
var helpers = new TestHarnessHelpers(bigInput: false);
bool ok = Bench(helpers, true);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
</PropertyGroup>
<PropertyGroup>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,24 @@

using System;
using System.IO;
using System.Runtime.CompilerServices;
using System.Security.Cryptography;
using Xunit;

namespace BenchmarksGame
{
public class Mandelbrot_2
{
public static int Main(String[] args)
[Fact]
public static int TestEntryPoint()
{
int width = 80;
if (args.Length > 0)
width = Int32.Parse(args[0]);
return Test(null);
}

[MethodImpl(MethodImplOptions.NoInlining)]
static int Test(int? arg)
{
int width = arg ?? 80;

int lineLen = (width - 1) / 8 + 1;
var bytes = new byte[width * lineLen];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
</PropertyGroup>
<PropertyGroup>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
Expand Down
Loading