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

add .net 9 rc1 #47

Merged
merged 2 commits into from
Sep 12, 2024
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
4 changes: 4 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
<EmbedUntrackedSources>true</EmbedUntrackedSources>
</PropertyGroup>

<PropertyGroup Label="Project Defaults">
<TargetFrameworks>net7.0;net8.0;net9.0</TargetFrameworks>
</PropertyGroup>

<PropertyGroup Label="C#">
<LangVersion>12.0</LangVersion>
<Nullable>enable</Nullable>
Expand Down
18 changes: 9 additions & 9 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
<PackageVersion Include="Ng.UserAgentService" Version="3.0.0" />
</ItemGroup>
<ItemGroup Label="Tests / Performance">
<PackageVersion Include="BenchmarkDotNet" Version="0.13.12" />
<PackageVersion Include="BenchmarkDotNet.Diagnostics.Windows" Version="0.13.12" />
<PackageVersion Include="BenchmarkDotNet" Version="0.14.0" />
<PackageVersion Include="BenchmarkDotNet.Diagnostics.Windows" Version="0.14.0" />
<PackageVersion Include="NSubstitute" Version="5.1.0" />
<PackageVersion Include="FluentAssertions" Version="7.0.0-alpha.2" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageVersion Include="xunit" Version="2.8.0" />
<PackageVersion Include="xunit.runner.console" Version="2.8.0">
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageVersion Include="xunit" Version="2.9.0" />
<PackageVersion Include="xunit.runner.console" Version="2.9.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageVersion>
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.0">
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageVersion>
Expand All @@ -35,15 +35,15 @@
</PackageVersion>
</ItemGroup>
<ItemGroup Label="Roslyn">
<PackageVersion Include="Roslynator.Analyzers" Version="4.12.2">
<PackageVersion Include="Roslynator.Analyzers" Version="4.12.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageVersion>
<PackageVersion Include="Roslynator.Formatting.Analyzers" Version="4.12.2">
<PackageVersion Include="Roslynator.Formatting.Analyzers" Version="4.12.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageVersion>
<PackageVersion Include="Roslynator.CodeAnalysis.Analyzers" Version="4.12.2">
<PackageVersion Include="Roslynator.CodeAnalysis.Analyzers" Version="4.12.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageVersion>
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"sdk": {
"version": "8.0.100"
"version": "9.0.100-rc.1.24452.12"
}
}
Original file line number Diff line number Diff line change
@@ -1,49 +1,49 @@
// Copyright © myCSharp.de - all rights reserved

using System.Collections.Generic;
using System.Linq;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Jobs;

#if OS_WIN
using BenchmarkDotNet.Diagnostics.Windows.Configs;
#endif

namespace MyCSharp.HttpUserAgentParser.Benchmarks
{
[MemoryDiagnoser]
namespace MyCSharp.HttpUserAgentParser.Benchmarks;

[MemoryDiagnoser]
[SimpleJob(RuntimeMoniker.Net80)]
[SimpleJob(RuntimeMoniker.Net90)]
#if OS_WIN
[EtwProfiler] // needs admin-rights
[EtwProfiler] // needs admin-rights
#endif
public class HttpUserAgentParserBenchmarks
public class HttpUserAgentParserBenchmarks
{
private string[] _testUserAgentMix;
private HttpUserAgentInformation[] _results;

[GlobalSetup]
public void GlobalSetup()
{
private string[] _testUserAgentMix;
private HttpUserAgentInformation[] _results;
_testUserAgentMix = GetTestUserAgents().ToArray();
_results = new HttpUserAgentInformation[_testUserAgentMix.Length];
}

[GlobalSetup]
public void GlobalSetup()
{
_testUserAgentMix = GetTestUserAgents().ToArray();
_results = new HttpUserAgentInformation[_testUserAgentMix.Length];
}
private static IEnumerable<string> GetTestUserAgents()
{
yield return "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36";
yield return "APIs-Google (+https://developers.google.com/webmasters/APIs-Google.html)";
yield return "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:88.0) Gecko/20100101 Firefox/88.0";
yield return "yeah I'm unknown user agent, just to bring some fun to the mix";
}

private static IEnumerable<string> GetTestUserAgents()
{
yield return "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36";
yield return "APIs-Google (+https://developers.google.com/webmasters/APIs-Google.html)";
yield return "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:88.0) Gecko/20100101 Firefox/88.0";
yield return "yeah I'm unknown user agent, just to bring some fun to the mix";
}
[Benchmark]
public void Parse()
{
string[] testUserAgentMix = _testUserAgentMix;
HttpUserAgentInformation[] results = _results;

[Benchmark]
public void Parse()
for (int i = 0; i < testUserAgentMix.Length; ++i)
{
string[] testUserAgentMix = _testUserAgentMix;
HttpUserAgentInformation[] results = _results;

for (int i = 0; i < testUserAgentMix.Length; ++i)
{
results[i] = HttpUserAgentParser.Parse(testUserAgentMix[i]);
}
results[i] = HttpUserAgentParser.Parse(testUserAgentMix[i]);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright © myCSharp.de - all rights reserved

using System.Collections.Generic;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Columns;
using BenchmarkDotNet.Configs;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net7.0;net8.0</TargetFrameworks>
<Nullable>disable</Nullable>
</PropertyGroup>

Expand Down
2 changes: 2 additions & 0 deletions perf/MyCSharp.HttpUserAgentParser.Benchmarks/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@
ManualConfig config = ManualConfig.Create(DefaultConfig.Instance)
.WithOptions(ConfigOptions.DisableOptimizationsValidator);


// dotnet run -c Release --framework net80 net90 --runtimes net90
BenchmarkSwitcher.FromAssembly(Assembly.GetExecutingAssembly()).Run(args, config);
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<PropertyGroup>
<Product>HTTP User Agent Parser Extensions for ASP.NET Core</Product>
<Description>HTTP User Agent Parser Extensions for ASP.NET Core</Description>
<TargetFrameworks>net7.0;net8.0</TargetFrameworks>
</PropertyGroup>

<PropertyGroup Label="Package">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<PropertyGroup>
<Product>HTTP User Agent Parser Extensions for IMemoryCache</Product>
<Description>HTTP User Agent Parser Extensions for IMemoryCache</Description>
<TargetFrameworks>net7.0;net8.0</TargetFrameworks>
</PropertyGroup>

<PropertyGroup Label="Package">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<PropertyGroup>
<Product>HTTP User Agent Parser</Product>
<Description>Parses user agents for Browser, Platform and Bots.</Description>
<TargetFrameworks>net7.0;net8.0</TargetFrameworks>
</PropertyGroup>

<PropertyGroup Label="Package">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net7.0;net8.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup Label="NuGet Roslyn">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net7.0;net8.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup Label="NuGet Roslyn">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net7.0;net8.0</TargetFrameworks>
</PropertyGroup>

<PropertyGroup>
<IsTestProject>false</IsTestProject>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net7.0;net8.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup Label="NuGet">
Expand Down