diff --git a/.github/workflows/benchpr.yml b/.github/workflows/benchpr.yml index b3ca475b..38bd01f5 100644 --- a/.github/workflows/benchpr.yml +++ b/.github/workflows/benchpr.yml @@ -39,8 +39,6 @@ jobs: run: dotnet build splitasm --configuration Release - name: Benchmark run: dotnet run --project "BitFaster.Caching.Benchmarks" -f net6.0 -c Release --filter '*' - - name: Plot results - run: dotnet run --project "Tools\BenchPlot\Benchplot.csproj" --configuration Release "BenchmarkDotNet.Artifacts" - name: Post process disassembly run: splitasm\splitasm\bin\Release\net6.0\splitasm.exe %GITHUB_WORKSPACE%\BenchmarkDotNet.Artifacts\results shell: cmd @@ -68,8 +66,6 @@ jobs: run: dotnet build --configuration Release --no-restore - name: Benchmark run: dotnet run --project "BitFaster.Caching.Benchmarks" -f net6.0 -c Release --filter '*' - - name: Plot results - run: dotnet run --project Tools/BenchPlot/BenchPlot.csproj --configuration Release "BenchmarkDotNet.Artifacts" - name: Publish Results uses: actions/upload-artifact@v3 with: @@ -94,8 +90,6 @@ jobs: run: dotnet build --configuration Release --no-restore - name: Benchmark run: dotnet run --project "BitFaster.Caching.Benchmarks" -f net6.0 -c Release --filter '*' - - name: Plot results - run: dotnet run --project "Tools\BenchPlot\BenchPlot.csproj" --configuration Release "BenchmarkDotNet.Artifacts" - name: Publish Results uses: actions/upload-artifact@v3 with: diff --git a/Tools/BenchPlot/BenchPlot.csproj b/Tools/BenchPlot/BenchPlot.csproj deleted file mode 100644 index 12841f96..00000000 --- a/Tools/BenchPlot/BenchPlot.csproj +++ /dev/null @@ -1,16 +0,0 @@ - - - - Exe - net6.0 - enable - enable - - - - - - - - - diff --git a/Tools/BenchPlot/BenchmarkData.cs b/Tools/BenchPlot/BenchmarkData.cs deleted file mode 100644 index 42b6f803..00000000 --- a/Tools/BenchPlot/BenchmarkData.cs +++ /dev/null @@ -1,29 +0,0 @@ -using CsvHelper.Configuration; - -namespace BenchPlot -{ - public class BenchmarkData - { - public string Method { get; set; } = string.Empty; - - public string Job { get; set; } = string.Empty; - - public string Mean { get; set; } = string.Empty; - - public string StdDev { get; set; } = string.Empty; - - //public string Size { get; set; } - } - - public class BenchMap : ClassMap - { - public BenchMap() - { - Map(m => m.Method).Name("Method"); - Map(m => m.Job).Name("Job"); - Map(m => m.Mean).Name("Mean"); - Map(m => m.StdDev).Name("StdDev"); - //Map(m => m.Size).Name("Size"); - } - } -} diff --git a/Tools/BenchPlot/PlotExt.cs b/Tools/BenchPlot/PlotExt.cs deleted file mode 100644 index fcab21ac..00000000 --- a/Tools/BenchPlot/PlotExt.cs +++ /dev/null @@ -1,36 +0,0 @@ -using Microsoft.FSharp.Core; -using Plotly.NET.LayoutObjects; -using Plotly.NET; - -namespace BenchPlot -{ - public static class PlotExt - { - public static GenericChart.GenericChart WithAxisTitles(this GenericChart.GenericChart chart, string yTitle) - { - var font = new FSharpOption(Font.init(Size: new FSharpOption(16))); - FSharpOption yt = new FSharpOption(yTitle); - return chart.WithXAxisStyle(Title.init(Font: font)).WithYAxisStyle(Title.init(yt, Font: font)); - } - - public static GenericChart.GenericChart WithoutVerticalGridlines(this GenericChart.GenericChart chart) - { - var gridColor = new FSharpOption(Color.fromKeyword(ColorKeyword.Gainsboro)); - var yaxis = LinearAxis.init( - GridColor: gridColor, - ZeroLineColor: gridColor); - - var axis = LinearAxis.init(ShowGrid: new FSharpOption(false)); - return chart.WithXAxis(axis).WithYAxis(yaxis); - } - - public static GenericChart.GenericChart WithLayout(this GenericChart.GenericChart chart, string title) - { - var font = new FSharpOption(Font.init(Size: new FSharpOption(24))); - FSharpOption t = Title.init(Text: title, X: 0.5, Font: font); - FSharpOption<Color> plotBGColor = new FSharpOption<Color>(Color.fromKeyword(ColorKeyword.WhiteSmoke)); - Layout layout = Layout.init<IConvertible>(PaperBGColor: plotBGColor, PlotBGColor: plotBGColor, Title: t); - return chart.WithLayout(layout); - } - } -} diff --git a/Tools/BenchPlot/Program.cs b/Tools/BenchPlot/Program.cs deleted file mode 100644 index 58c090e7..00000000 --- a/Tools/BenchPlot/Program.cs +++ /dev/null @@ -1,104 +0,0 @@ -using BenchPlot; -using CsvHelper; -using Plotly.NET; -using Plotly.NET.ImageExport; -using System.Data; -using System.Globalization; -using Chart = Plotly.NET.CSharp.Chart; - -if (args.Length != 1) -{ - Console.WriteLine($"Invalid args"); - return 1; -} - -string inputPath = args[0]; -string outputPath = Path.Combine(inputPath, "plots"); - -Console.WriteLine($"Looking for results dir at {inputPath}"); - -string[] files = System.IO.Directory.GetFiles(Path.Combine(inputPath, "results"), "*.csv"); - -if (files.Length == 0) -{ - Console.WriteLine($"No benchmark results found"); - return 2; -} -else -{ - Console.WriteLine($"Found {files.Length} benchmark results."); -} - -if (!Directory.Exists(outputPath)) -{ - Console.WriteLine($"Creating plots dir at {outputPath}"); - Directory.CreateDirectory(outputPath); -} - -foreach (string file in files) -{ - string benchName = Path.GetFileNameWithoutExtension(file).Replace("-report", string.Empty); - - Console.WriteLine($"Processing {benchName}"); - - using (var reader = new StreamReader(file)) - using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture)) - { - csv.Context.RegisterClassMap<BenchMap>(); - var records = csv.GetRecords<BenchmarkData>(); - - var jobs = records.GroupBy(r => r.Job).ToList(); - - // plot one column chart for each job - foreach (var job in jobs) - { - Console.WriteLine($"Plotting {job.Key}..."); - - var methods = job.Select(r => r.Method).ToArray(); - var nanos = job.Select(r => TimeParser.Parse(r.Mean)).ToArray(); - var stdDev = job.Select(r => TimeParser.Parse(r.StdDev)).ToArray(); - - var fn = $"{benchName} ({job.Key})"; - var chart = Chart.Column<double, string, string>(nanos, methods, MarkerColor: Plotly.NET.Color.fromKeyword(Plotly.NET.ColorKeyword.IndianRed)) - .WithYErrorStyle<double, IConvertible>(stdDev) - .WithAxisTitles("Time (ns)") - .WithoutVerticalGridlines() - .WithLayout(fn); - - chart.SaveSVG(Path.Combine(outputPath, fn), Width: 1000, Height: 600); - } - - // plot a column chart with results grouped by job - if (jobs.Count() > 1) - { - Console.WriteLine($"Plotting combined jobs..."); - - List<ColorKeyword> colors = new List<ColorKeyword>() { ColorKeyword.IndianRed, ColorKeyword.Salmon }; - List<GenericChart.GenericChart> charts = new List<GenericChart.GenericChart>(); - - int ind = 0; - foreach (var job in jobs) - { - var methods = job.Select(r => r.Method).ToArray(); - var nanos = job.Select(r => TimeParser.Parse(r.Mean)).ToArray(); - var stdDev = job.Select(r => TimeParser.Parse(r.StdDev)).ToArray(); - - var chart = Chart.Column<double, string, string>(nanos, methods, job.Key, MarkerColor: Plotly.NET.Color.fromKeyword(colors[ind++])) - .WithYErrorStyle<double, IConvertible>(stdDev); - - charts.Add(chart); - } - - var combined = Chart.Combine(charts); - - var fn = $"{benchName}"; - combined - .WithAxisTitles("Time (ns)") - .WithoutVerticalGridlines() - .WithLayout(fn) - .SaveSVG(Path.Combine(outputPath, fn), Width: 1000, Height: 600); - } - } -} - -return 0; diff --git a/Tools/BenchPlot/TimeParser.cs b/Tools/BenchPlot/TimeParser.cs deleted file mode 100644 index b1d0d613..00000000 --- a/Tools/BenchPlot/TimeParser.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace BenchPlot -{ - public static class TimeParser - { - public static double Parse(string time) - { - var split = time.Split(' '); - - if (time.EndsWith("μs")) - { - return double.Parse(split[0]) * 0.001; - } - - if (time.EndsWith("ns")) - { - return double.Parse(split[0]); - } - - if (time.EndsWith("ms")) - { - return double.Parse(split[0]) * 1_000_000; - } - - if (time.EndsWith("NA")) - { - return 0; - } - - if (time.EndsWith("?")) - { - return 0; - } - - throw new InvalidOperationException(); - } - } -} diff --git a/Tools/Tools.sln b/Tools/Tools.sln index edb34c8d..db799e74 100644 --- a/Tools/Tools.sln +++ b/Tools/Tools.sln @@ -5,8 +5,6 @@ VisualStudioVersion = 17.7.34202.233 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HashTableSize", "HashTableSize\HashTableSize.csproj", "{127B7B6D-ECE7-4056-87D2-5C2A4477BAEC}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BenchPlot", "BenchPlot\BenchPlot.csproj", "{A3AA1ECB-E753-4E73-B2A8-09434FAF2664}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -17,10 +15,6 @@ Global {127B7B6D-ECE7-4056-87D2-5C2A4477BAEC}.Debug|Any CPU.Build.0 = Debug|Any CPU {127B7B6D-ECE7-4056-87D2-5C2A4477BAEC}.Release|Any CPU.ActiveCfg = Release|Any CPU {127B7B6D-ECE7-4056-87D2-5C2A4477BAEC}.Release|Any CPU.Build.0 = Release|Any CPU - {A3AA1ECB-E753-4E73-B2A8-09434FAF2664}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A3AA1ECB-E753-4E73-B2A8-09434FAF2664}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A3AA1ECB-E753-4E73-B2A8-09434FAF2664}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A3AA1ECB-E753-4E73-B2A8-09434FAF2664}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Tools/benchrunner.cmd b/Tools/benchrunner.cmd deleted file mode 100644 index b6a3bff7..00000000 --- a/Tools/benchrunner.cmd +++ /dev/null @@ -1,2 +0,0 @@ -cd .. -dotnet run --project "BitFaster.Caching.Benchmarks" -f net6.0 -c Release --filter *Lru* \ No newline at end of file