Skip to content

Commit

Permalink
[tests] Add perf test for calling Marshal.AllocHGlobal/FreeHGlobal.
Browse files Browse the repository at this point in the history
Also add a 'SupportedOSPlatformVersion' value to the .NET perftest project
file, to cope with recent changes in our .NET support.

Ref: dotnet/runtime#58939.
  • Loading branch information
rolfbjarne committed Sep 10, 2021
1 parent f559399 commit 0310d34
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/perftest/ManagedRuntime.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;
using System.Runtime.InteropServices;

using BenchmarkDotNet.Attributes;

namespace PerfTest {

public class ManagedRuntime {
[Benchmark]
public void AllocHGlobal ()
{
Marshal.FreeHGlobal (Marshal.AllocHGlobal (1));
}
}
}
1 change: 1 addition & 0 deletions tests/perftest/dotnet/perftest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<MonoBundlingExtraArgs>--marshal-objectivec-exceptions:disable --registrar:static</MonoBundlingExtraArgs>
<LinkMode>None</LinkMode> <!-- never link -->
<Optimize>true</Optimize> <!-- always optimize -->
<SupportedOSPlatformVersion>10.15</SupportedOSPlatformVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.12.1" />
Expand Down

0 comments on commit 0310d34

Please sign in to comment.