Skip to content

Commit

Permalink
Refactor Benchmarks to work with AOT (#433)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamescourtney authored Mar 8, 2024
1 parent 2a096ba commit a71a0ff
Show file tree
Hide file tree
Showing 25 changed files with 1,634 additions and 1,676 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ jobs:
- name: Restore dependencies
working-directory: src
run: dotnet restore

- name: Build FlatSharp.Compiler
working-directory: src/FlatSharp.Compiler
run: dotnet build -c Release /p:SignAssembly=true

- name: Run FlatSharp.Compiler (E2E Tests)
# You may pin to the exact commit or the version.
# uses: Amadevus/pwsh-script@97a8b211a5922816aa8a69ced41fa32f23477186
Expand All @@ -66,7 +66,7 @@ jobs:
script: |
$fbs = (gci -r src/Tests/FlatSharpPoolableEndToEndTests/*.fbs) -join ";"
dotnet src/FlatSharp.Compiler/bin/Release/net8.0/FlatSharp.Compiler.dll --nullable-warnings false --normalize-field-names true --gen-poolable true --input "$fbs" -o src/Tests/FlatSharpPoolableEndToEndTests
- name: Build
working-directory: src
run: dotnet build -c Release /p:SignAssembly=true
Expand Down
47 changes: 45 additions & 2 deletions src/Benchmarks/Benchmark/Benchmark.csproj
Original file line number Diff line number Diff line change
@@ -1,23 +1,66 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFramework>net8.0</TargetFramework>
<DelaySign>false</DelaySign>
<SignAssembly>false</SignAssembly>
<DefineConstants>$(DefineContants);CURRENT_VERSION_ONLY;RUN_COMPARISON_BENCHMARKS;FLATSHARP_7_0_0_OR_GREATER</DefineConstants>
<FlatSharpCompilerPath>$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)\..\..\FlatSharp.Compiler\bin\Release\net8.0\FlatSharp.Compiler.dll'))</FlatSharpCompilerPath>
<FlatSharpNameNormalization>true</FlatSharpNameNormalization>
<RunAnalyzersDuringLiveAnalysis>False</RunAnalyzersDuringLiveAnalysis>
</PropertyGroup>

<PropertyGroup Condition=" '$(BuildAot)' == 'true' ">
<DefineConstants>$(DefineConstants);AOT</DefineConstants>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" />
<PackageReference Include="BenchmarkDotNet.Diagnostics.Windows" />
<PackageReference Include="Google.Protobuf" />
<PackageReference Include="Grpc.Tools">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup Condition=" '$(BuildAot)' != 'true' ">
<PackageReference Include="MessagePack" />
<PackageReference Include="Newtonsoft.Json" />
<PackageReference Include="protobuf-net" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\FlatSharp\FlatSharp.csproj" />
<ProjectReference Include="..\..\FlatSharp.Runtime\FlatSharp.Runtime.csproj" />
<ProjectReference Include="..\..\Google.FlatBuffers\Google.FlatBuffers.csproj" />
</ItemGroup>

<ItemGroup>
<None Include="BenchmarkUtilities.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>BenchmarkUtilities.tt</DependentUpon>
</None>
<Compile Update="BenchmarkUtilities.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>BenchmarkUtilities.tt</DependentUpon>
</Compile>
<None Update="BenchmarkUtilities.tt">
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>BenchmarkUtilities.cs</LastGenOutput>
</None>
</ItemGroup>

<ItemGroup>
<FlatSharpSchema Include="FBBench/FlatSharp.fbs" />
<Protobuf Include="FBBench/Benchmark.proto" />
</ItemGroup>

<Import Project="..\..\FlatSharp.Compiler\FlatSharp.Compiler.targets" />

<Target Name="BuildCompiler" BeforeTargets="FlatSharpFbsCompile">
<MSBuild Projects="..\..\FlatSharp.Compiler\FlatSharp.Compiler.csproj" Properties="Configuration=Release;TargetFramework=net8.0" />
</Target>

</Project>
Loading

0 comments on commit a71a0ff

Please sign in to comment.