-
Notifications
You must be signed in to change notification settings - Fork 274
/
Copy pathPerf.NumberCultureInfo.cs
31 lines (28 loc) · 1.06 KB
/
Perf.NumberCultureInfo.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using BenchmarkDotNet.Attributes;
using MicroBenchmarks;
namespace System.Globalization.Tests
{
/// <summary>
/// Performance tests for converting numbers to different CultureInfos
/// </summary>
[BenchmarkCategory(Categories.Libraries)]
public class Perf_NumberCultureInfo
{
public IEnumerable<object> Cultures()
{
yield return new CultureInfo("fr");
yield return new CultureInfo("da");
yield return new CultureInfo("ja");
yield return new CultureInfo("");
}
[Benchmark]
[ArgumentsSource(nameof(Cultures))]
[MemoryRandomization]
public string ToString(CultureInfo culturestring) // the argument is called "culturestring" to keep benchmark ID, do NOT rename it
=> 104234.343.ToString(culturestring);
}
}