Skip to content
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 .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ jobs:
with:
dotnet-version: 8.0.100

- uses: actions/setup-dotnet@v1
with:
dotnet-version: 9.0.200

- name: Package Nightly Nuget 📦
run: |
SUFFIX=`date "+%y%m%d%H%M%S"`
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ jobs:
with:
dotnet-version: 8.0.100

- uses: actions/setup-dotnet@v1
with:
dotnet-version: 9.0.200

- name: Check Building ⚙
run: |
dotnet build
4 changes: 4 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ jobs:
with:
dotnet-version: 8.0.100

- uses: actions/setup-dotnet@v1
with:
dotnet-version: 9.0.200

- name: Package and publish to Nuget📦
run: |
VERSION=`git describe --tags`
Expand Down
27 changes: 17 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,29 +65,36 @@ The CssInCSharp is similar to less or sass. You can simply convert you style fil
## Benchmark
```

BenchmarkDotNet v0.13.12, Windows 11 (10.0.22631.3593/23H2/2023Update/SunValley3)
BenchmarkDotNet v0.13.12, Windows 11 (10.0.26100.3775)
AMD Ryzen 7 5700G with Radeon Graphics, 1 CPU, 16 logical and 8 physical cores
.NET SDK 8.0.300
[Host] : .NET 8.0.5 (8.0.524.21615), X64 RyuJIT AVX2
.NET SDK 9.0.200
[Host] : .NET 9.0.2 (9.0.225.6610), 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
.NET 8.0 : .NET 8.0.13 (8.0.1325.6609), X64 RyuJIT AVX2
.NET 9.0 : .NET 9.0.2 (9.0.225.6610), X64 RyuJIT AVX2


```
| 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 |
| Method | Job | Runtime | Mean | Error | StdDev | Median | Ratio | RatioSD | Gen0 | Gen1 | Allocated | Alloc Ratio |
|---------- |--------- |--------- |---------:|---------:|---------:|---------:|------:|--------:|--------:|-------:|----------:|------------:|
| CreateCss | .NET 5.0 | .NET 5.0 | 55.68 μs | 1.112 μs | 1.795 μs | 55.56 μs | 1.00 | 0.00 | 20.0806 | 1.0986 | 164.32 KB | 1.00 |
| CreateCss | .NET 6.0 | .NET 6.0 | 51.66 μs | 1.024 μs | 2.374 μs | 52.28 μs | 0.91 | 0.05 | 19.3481 | 1.0986 | 158.04 KB | 0.96 |
| CreateCss | .NET 7.0 | .NET 7.0 | 48.51 μs | 0.969 μs | 1.450 μs | 48.49 μs | 0.87 | 0.03 | 19.3481 | 1.0376 | 158.11 KB | 0.96 |
| CreateCss | .NET 8.0 | .NET 8.0 | 41.71 μs | 1.585 μs | 4.391 μs | 40.90 μs | 0.81 | 0.08 | 19.2871 | 1.0986 | 157.98 KB | 0.96 |
| CreateCss | .NET 9.0 | .NET 9.0 | 33.33 μs | 0.660 μs | 1.840 μs | 32.80 μs | 0.62 | 0.03 | 19.2871 | 1.0986 | 157.98 KB | 0.96 |



## Special Thanks

[cssinjs](https://github.com/ant-design/cssinjs): Component level cssinjs solution used in ant.design.

[stylis](https://github.com/thysultan/stylis): A Light–weight CSS Preprocessor.

[csstype](https://github.com/frenic/csstype): TypeScript and Flow definitions for CSS.

[tinycolor](https://github.com/scttcper/tinycolor): A small library for color manipulation and conversion.

[TypeScriptAST](https://github.com/ToCSharp/TypeScriptAST): .NET port of TypeScript parser.
1 change: 1 addition & 0 deletions benchmark/CssInCSharp.Benchmarks/Benchmark.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ namespace CssInCSharp.Benchmarks
[SimpleJob(RuntimeMoniker.Net60)]
[SimpleJob(RuntimeMoniker.Net70)]
[SimpleJob(RuntimeMoniker.Net80)]
[SimpleJob(RuntimeMoniker.Net90)]
[Config(typeof(Config))]
public class Benchmark
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net5;net6;net7;net8</TargetFrameworks>
<TargetFrameworks>net5;net6;net7;net8;net9.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
Expand Down
6 changes: 5 additions & 1 deletion src/CssInCSharp.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<TargetFrameworks>netstandard2.1;net5;net6;net7;net8</TargetFrameworks>
<TargetFrameworks>netstandard2.1;net5;net6;net7;net8;net9.0</TargetFrameworks>
<LangVersion>latest</LangVersion>
<OutputType>Library</OutputType>
<IsPackable>true</IsPackable>
Expand Down Expand Up @@ -56,6 +56,10 @@
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.0" />
</ItemGroup>

<ItemGroup Condition="$(TargetFramework) == 'net9.0'">
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="9.0.0" />
</ItemGroup>

<ItemGroup>
<None Remove="CssInCSharp.csproj.DotSettings" />
</ItemGroup>
Expand Down
Loading