xamarin-macios/tests/perftest
Sebastien Pouliot 2691791ad2
[corefoundation] Optimize `CFArray` (#12740)
The added test case has not shown any major performance enhancement,
anything (if) is lost in the noise.

Beside the performance the change has two small size advantages
* `Create` does not call another method (less metadata)
* `GetCount` is now the p/invoke `CFArrayGetCount`

Before

// * Summary *

BenchmarkDotNet=v0.12.1.1528-nightly, OS=macOS Big Sur 11.5.2 (20G95) [Darwin 20.6.0]
Intel Core i7-4790K CPU 4.00GHz (Haswell), 1 CPU, 8 logical and 4 physical cores
  [Host] : Mono 6.12.0 (2020-02/3cf59ad33da), X64

Job=InProcess  Toolchain=InProcessEmitToolchain  IterationCount=3
LaunchCount=1  WarmupCount=3

| Method | Length |        Mean |       Error |    StdDev |
|------- |------- |------------:|------------:|----------:|
| Create |      0 |    255.4 ns |    53.68 ns |   2.94 ns |
| Create |      1 |    343.0 ns |     8.55 ns |   0.47 ns |
| Create |     16 |    443.8 ns |    30.54 ns |   1.67 ns |
| Create |    256 |  1,898.4 ns |   246.80 ns |  13.53 ns |
| Create |   4096 | 40,503.2 ns | 5,395.81 ns | 295.76 ns |

// * Legends *
  Length : Value of the 'Length' parameter
  Mean   : Arithmetic mean of all measurements
  Error  : Half of 99.9% confidence interval
  StdDev : Standard deviation of all measurements
  1 ns   : 1 Nanosecond (0.000000001 sec)

// ***** BenchmarkRunner: End *****
Global total time: 00:00:33 (33.26 sec), executed benchmarks: 5

After

// * Summary *

BenchmarkDotNet=v0.12.1.1528-nightly, OS=macOS Big Sur 11.5.2 (20G95) [Darwin 20.6.0]
Intel Core i7-4790K CPU 4.00GHz (Haswell), 1 CPU, 8 logical and 4 physical cores
  [Host] : Mono 6.12.0 (2020-02/3cf59ad33da), X64

Job=InProcess  Toolchain=InProcessEmitToolchain  IterationCount=3
LaunchCount=1  WarmupCount=3

| Method | Length |        Mean |       Error |   StdDev |
|------- |------- |------------:|------------:|---------:|
| Create |      0 |    246.3 ns |    55.49 ns |  3.04 ns |
| Create |      1 |    341.1 ns |    18.13 ns |  0.99 ns |
| Create |     16 |    425.4 ns |    34.97 ns |  1.92 ns |
| Create |    256 |  1,741.1 ns |   298.87 ns | 16.38 ns |
| Create |   4096 | 40,333.6 ns | 1,646.70 ns | 90.26 ns |

// * Legends *
  Length : Value of the 'Length' parameter
  Mean   : Arithmetic mean of all measurements
  Error  : Half of 99.9% confidence interval
  StdDev : Standard deviation of all measurements
  1 ns   : 1 Nanosecond (0.000000001 sec)

// ***** BenchmarkRunner: End *****
Global total time: 00:00:31 (31.68 sec), executed benchmarks: 5
2021-09-16 08:39:16 +02:00
..
Assets.xcassets [tests] Add a performance test using BenchmarkDotNet. (#11298) 2021-04-23 13:29:06 +02:00
dotnet [tests] Add perf test for calling Marshal.AllocHGlobal/FreeHGlobal. (#12696) 2021-09-13 16:14:37 +02:00
legacy [corefoundation] Optimize `CFArray` (#12740) 2021-09-16 08:39:16 +02:00
.gitignore [tests] Add a performance test using BenchmarkDotNet. (#11298) 2021-04-23 13:29:06 +02:00
AppDelegate.cs [tests] Add a performance test using BenchmarkDotNet. (#11298) 2021-04-23 13:29:06 +02:00
Entitlements.plist [tests] Add a performance test using BenchmarkDotNet. (#11298) 2021-04-23 13:29:06 +02:00
Info.plist [tests] Add a performance test using BenchmarkDotNet. (#11298) 2021-04-23 13:29:06 +02:00
Main.cs [tests] Add a performance test using BenchmarkDotNet. (#11298) 2021-04-23 13:29:06 +02:00
Main.storyboard [tests] Add a performance test using BenchmarkDotNet. (#11298) 2021-04-23 13:29:06 +02:00
Makefile [dotnet] Remove the .NET workload resolver workaround, it's not needed anymore. (#11695) 2021-05-27 07:30:46 +02:00
ManagedRuntime.cs [tests] Add perf test for calling Marshal.AllocHGlobal/FreeHGlobal. (#12696) 2021-09-13 16:14:37 +02:00
MessageSend.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
Messaging.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
NativeArrayPerf.cs [corefoundation] Optimize `CFArray` (#12740) 2021-09-16 08:39:16 +02:00
ObjCBridge.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
ObjectCreation.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
README.md [tests] Add a performance test using BenchmarkDotNet. (#11298) 2021-04-23 13:29:06 +02:00
TollFreeBridge.cs [corefoundation] Use `CFArrayGetValues` inside `CFArray` (#12537) 2021-08-26 16:37:31 -04:00
ViewController.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
ViewController.designer.cs [tests] Add a performance test using BenchmarkDotNet. (#11298) 2021-04-23 13:29:06 +02:00
perftest.sln [tests] Add a performance test using BenchmarkDotNet. (#11298) 2021-04-23 13:29:06 +02:00

README.md

Benchmarks

This folder contains a test suite to test performance in Xamarin.iOS/Xamarin.Mac.

There are three variations of the test suite:

  • Legacy mode (Xamarin).

  • .NET Mode (Mono): runs tests in .NET, with MonoVM.

  • .NET Mode (CoreCLR): runs tests using .NET, with CoreCLR.

Running the benchmarks

Run all three variations of the test suite:

make run-perftest

Run each variation:

Legacy mode

make run-perftest-with-legacy

.NET Mode (Mono)

make run-perftest-with-mono

.NET Mode (CoreCLR)

make run-perftest-with-coreclr

Results

At the end of the test run, something like this will be printed:

Log files were stored in xamarin-macios/tests/perftest/output/2021-04-22--21:43:28

and that's where you'll find log files. Console output from the executable is stored as perflog-[timestamp].log, while BenchmarkDotNet results are exported to the results/ subfolder (in json, markdown, csv and html formats).

There's no easy way to compare results across variations or runs (yet), the exported results will have to be examined by a human and compared that way.