Skip to content

Commit

Permalink
chore: update all project to net8 (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
yoli799480165 authored May 28, 2024
1 parent f463ec0 commit 7f04038
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 27 deletions.
26 changes: 18 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,23 @@ For other examples, you can check out the example code.
The CssInCSharp is similar to less or sass. You can simply convert you style file into C# class, so that you can make full use of the C# language features to generate style content.

## Benchmark
``` ini
BenchmarkDotNet=v0.13.5, OS=Windows 11 (10.0.22621.1702/22H2/2022Update/SunValley2)
```
BenchmarkDotNet v0.13.12, Windows 11 (10.0.22631.3593/23H2/2023Update/SunValley3)
AMD Ryzen 7 5700G with Radeon Graphics, 1 CPU, 16 logical and 8 physical cores
.NET SDK=7.0.203
[Host] : .NET 7.0.5 (7.0.523.17405), X64 RyuJIT AVX2
DefaultJob : .NET 7.0.5 (7.0.523.17405), X64 RyuJIT AVX2
.NET SDK 8.0.300
[Host] : .NET 8.0.5 (8.0.524.21615), X64 RyuJIT AVX2
.NET 5.0 : .NET 5.0.17 (5.0.1722.21314), X64 RyuJIT AVX2
.NET 6.0 : .NET 6.0.28 (6.0.2824.12007), X64 RyuJIT AVX2
.NET 7.0 : .NET 7.0.17 (7.0.1724.11508), X64 RyuJIT AVX2
.NET 8.0 : .NET 8.0.5 (8.0.524.21615), X64 RyuJIT AVX2
```
| Method | Mean | Error | StdDev | Median | Gen0 | Gen1 | Allocated |
|---------- |---------:|---------:|---------:|---------:|--------:|-------:|----------:|
| CreateCss | 39.71 μs | 0.789 μs | 1.595 μs | 38.98 μs | 17.6392 | 1.0376 | 144.29 KB |
| Method | Job | Runtime | Mean | Error | StdDev | Ratio | RatioSD | Gen0 | Gen1 | Allocated | Alloc Ratio |
|---------- |--------- |--------- |---------:|---------:|---------:|------:|--------:|--------:|-------:|----------:|------------:|
| CreateCss | .NET 5.0 | .NET 5.0 | 58.99 μs | 1.179 μs | 2.001 μs | 1.00 | 0.00 | 18.4326 | 0.9766 | 150.64 KB | 1.00 |
| CreateCss | .NET 6.0 | .NET 6.0 | 55.16 μs | 1.076 μs | 1.797 μs | 0.94 | 0.04 | 17.6392 | 1.0376 | 144.36 KB | 0.96 |
| CreateCss | .NET 7.0 | .NET 7.0 | 50.61 μs | 0.999 μs | 2.062 μs | 0.87 | 0.05 | 17.6392 | 1.0376 | 144.42 KB | 0.96 |
| CreateCss | .NET 8.0 | .NET 8.0 | 37.73 μs | 0.748 μs | 1.642 μs | 0.65 | 0.03 | 17.6392 | 0.9155 | 144.3 KB | 0.96 |

7 changes: 6 additions & 1 deletion benchmark/CssInCSharp.Benchmarks/Benchmark.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Diagnosers;
using BenchmarkDotNet.Jobs;

namespace CssInCs.Benchmarks
namespace CssInCSharp.Benchmarks
{
[SimpleJob(RuntimeMoniker.Net50, baseline: true)]
[SimpleJob(RuntimeMoniker.Net60)]
[SimpleJob(RuntimeMoniker.Net70)]
[SimpleJob(RuntimeMoniker.Net80)]
[Config(typeof(Config))]
public class Benchmark
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFrameworks>net5;net6;net7;net8</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
</PropertyGroup>

<ItemGroup>
<Compile Include="..\..\examples\css\Styles.cs" Link="Styles.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.13.5" />
<PackageReference Include="BenchmarkDotNet" Version="0.13.12" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion benchmark/CssInCSharp.Benchmarks/Program.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// See https://aka.ms/new-console-template for more information
using BenchmarkDotNet.Running;
using CssInCs.Benchmarks;
using CssInCSharp.Benchmarks;

var summary = BenchmarkRunner.Run<Benchmark>();
6 changes: 3 additions & 3 deletions examples/Examples.Basic/Examples.Basic.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
Expand All @@ -7,8 +7,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.5" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.5" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions examples/Examples.Basic/Pages/Animation.razor
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
["& .title"] = new CSSObject
{
Height = 20,
LineHeight = 20,
LineHeight = "20px",
FontSize = 14
},
["& .animation"] = new CSSObject
Expand Down Expand Up @@ -64,7 +64,7 @@
["& .title"] = new CSSObject
{
Height = 20,
LineHeight = 20,
LineHeight = "20px",
FontSize = 14
},
["& .animation"] = new CSSObject
Expand Down
6 changes: 3 additions & 3 deletions examples/Examples.Component/Examples.Component.csproj
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.5" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.5" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.5" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.5" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
Expand Down
13 changes: 6 additions & 7 deletions test/CssInCSharp.Tests/CssInCSharp.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="bunit" Version="1.25.3" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="bunit" Version="1.28.9" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="Shouldly" Version="4.2.1" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PackageReference Include="xunit" Version="2.8.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.1">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.2.0">
<PackageReference Include="coverlet.collector" Version="6.0.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down

0 comments on commit 7f04038

Please sign in to comment.