{"id":26673736,"url":"https://github.com/mjebrahimi/benchmarkdotnetvisualizer","last_synced_at":"2025-04-09T06:13:12.299Z","repository":{"id":217716552,"uuid":"744607761","full_name":"mjebrahimi/BenchmarkDotNetVisualizer","owner":"mjebrahimi","description":"🌈 Visualizes your BenchmarkDotNet benchmarks to Colorful images and Feature-rich HTML (and maybe powerful charts in the future!)","archived":false,"fork":false,"pushed_at":"2025-02-10T18:04:37.000Z","size":7194,"stargazers_count":50,"open_issues_count":5,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-02T04:08:05.080Z","etag":null,"topics":["benchmark","benchmarkdotnet","benchmarking","benchmarks","csharp","dotnet","exporter","performance","performance-visualization","visualization","visualizer"],"latest_commit_sha":null,"homepage":"https://mjebrahimi.github.io/BenchmarkDotNetVisualizer/","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mjebrahimi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-17T16:40:01.000Z","updated_at":"2025-03-14T05:00:41.000Z","dependencies_parsed_at":"2024-01-18T01:58:36.229Z","dependency_job_id":"4b5bdc3b-8c4b-463f-842a-0b99524b6eb4","html_url":"https://github.com/mjebrahimi/BenchmarkDotNetVisualizer","commit_stats":null,"previous_names":["mjebrahimi/benchmarkdotnetvisualizer"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjebrahimi%2FBenchmarkDotNetVisualizer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjebrahimi%2FBenchmarkDotNetVisualizer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjebrahimi%2FBenchmarkDotNetVisualizer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjebrahimi%2FBenchmarkDotNetVisualizer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mjebrahimi","download_url":"https://codeload.github.com/mjebrahimi/BenchmarkDotNetVisualizer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247987285,"owners_count":21028895,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["benchmark","benchmarkdotnet","benchmarking","benchmarks","csharp","dotnet","exporter","performance","performance-visualization","visualization","visualizer"],"created_at":"2025-03-26T01:37:31.626Z","updated_at":"2025-04-09T06:13:12.284Z","avatar_url":"https://github.com/mjebrahimi.png","language":"HTML","readme":"**Examples:**\n- [Online Demo 1](https://mjebrahimi.github.io/BenchmarkDotNetVisualizer/docs/json-serializers-benchmark.html)\n- [Online Demo 2](https://mjebrahimi.github.io/BenchmarkDotNetVisualizer/docs/iteration-benchmark1.html)\n- [Online Demo 3](https://mjebrahimi.github.io/BenchmarkDotNetVisualizer/docs/iteration-benchmark2.html)\n\n[![NuGet](https://img.shields.io/nuget/dt/BenchmarkDotNetVisualizer?style=flat\u0026logo=nuget\u0026cacheSeconds=1\u0026label=Downloads)](https://www.nuget.org/packages/BenchmarkDotNetVisualizer)\n[![NuGet](https://img.shields.io/nuget/v/BenchmarkDotNetVisualizer?label=Version\u0026cacheSeconds=1)](https://www.nuget.org/packages/BenchmarkDotNetVisualizer)\n[![License: MIT](https://img.shields.io/badge/License-MIT-brightgreen.svg)](https://opensource.org/licenses/MIT)\n[![Build Status](https://github.com/mjebrahimi/BenchmarkDotNetVisualizer/workflows/.NET/badge.svg)](https://github.com/mjebrahimi/BenchmarkDotNetVisualizer)\n\n# BenchmarkDotNetVisualizer\n\nVisualizes your [BenchmarkDotNet](https://github.com/dotnet/BenchmarkDotNet/) benchmarks to **Colorful** images and **Feature-rich** HTML (and maybe powerful charts in the future!)\n\n**Dark Theme:**\n\n![for, foreach, ForEach() Benchmark - Dark Theme](https://raw.githubusercontent.com/mjebrahimi/BenchmarkDotNetVisualizer/master/samples/JsonSerializersBenchmark/Reports/Benchmark-Dark.png)\n\n**Light Theme:**\n\n![for, foreach, ForEach() Benchmark - Light Theme](https://raw.githubusercontent.com/mjebrahimi/BenchmarkDotNetVisualizer/master/samples/JsonSerializersBenchmark/Reports/Benchmark-Light.png)\n\n## A Real World Demo (.NET Collections Benchmark 🚀)\n\nA Comprehensive Performance Comparison Benchmark Between Different .NET Collections.\n\nhttps://github.com/mjebrahimi/DotNet-Collections-Benchmark/\n\n## Getting Started\n\n### 1. Install Package\n\n```ini\nPM\u003e Install-Package BenchmarkDotNetVisualizer\n```\n\n### 2. Using Methods (Recommended)\n\n**Methods:**\n\n- **SaveAsImageAsync()**\n- **SaveAsHtmlAsync()**\n- **SaveAsHtmlAndImageAsync()**\n\n**Example:**\n\n```csharp\nvar summary = BenchmarkAutoRunner.Run\u003cJsonSerializersBenchmark\u003e(); //Prefer to use BenchmarkAutoRunner instead of BenchmarkRunner\n\n//[ProjectDirectory]\\Reports\\Benchmark-Dark.html\nvar htmlPath = DirectoryHelper.GetPathRelativeToProjectDirectory(@\"Reports\\Benchmark-Dark.html\");\n\n//[ProjectDirectory]\\Reports\\Benchmark-Dark.png\nvar imgPath = DirectoryHelper.GetPathRelativeToProjectDirectory(@\"Reports\\Benchmark-Dark.png\");\n\nvar options = new ReportHtmlOptions\n{\n    Title = \"Json Serializers Benchmark\",\n    GroupByColumns = [\"Method\"],                          // Groups by 'Method' column and highlights groups\n    SpectrumColumns = [\"Mean\", \"Allocated\"],              // Colorizes 'Mean' and 'Allocated' columns as Spectrum\n    DividerMode = RenderTableDividerMode.EmptyDividerRow, // Separates tables by Empty Divider Row\n    HtmlWrapMode = HtmlDocumentWrapMode.Simple,           // Uses simple HTML table\n    Theme = Theme.Dark                                    // Optional (Default is Dark)\n};\n\nawait summary.SaveAsHtmlAndImageAsync(htmlPath, imgPath, options);\n```\n\n**Note: Use BenchmarkAutoRunner to Run your benchmarks**\n\nPrefer to use **BenchmarkAutoRunner.Run()** instead of **BenchmarkRunner.Run()** to run your benchmarks.\n`BenchmarkAutoRunner` is **similar** to `BenchmarkRunner`, but is **Smarter!**\n\n\u003c!-- \n- It uses `Job.Dry` with `InProcessEmitToolchain` is case of **DEBUG** mode (due to **ease of debugging**), and your **specified job** in case of **RELEASE** mode.\n- It also **Warns** you if you are running project **Wrongly**. (for example running with **Attached Debugger** while in **RELEASE** mode)\n- It starts to download browser **WebDriver** automatically in the **background** if it's not found in your system. (which is required for rendering images)\n--\u003e\n\n```csharp\nBenchmarkAutoRunner.Run\u003cJsonSerializersBenchmark\u003e();\n// Instead of \n//BenchmarkRunner.Run\u003cJsonSerializersBenchmark\u003e();\n```\n\n**Output HTML:**\n\nVisit [this HTML page](https://mjebrahimi.github.io/BenchmarkDotNetVisualizer/docs/json-serializers-benchmark.html) at `samples/JsonSerializersBenchmark/Reports/Benchmark-Dark.html`\n\n**Output Image:**\n\n![Json Serializers Benchmark](https://raw.githubusercontent.com/mjebrahimi/BenchmarkDotNetVisualizer/master/samples/JsonSerializersBenchmark/Reports/Benchmark-Dark.png)\n\n### 3. Or Using Exporters\n\n**Note:** prefer to use previous (recommended) methods.\n\n**Exporters:**\n\n- **[RichImageExporter]**\n- **[RichHtmlExporter]**\n\n**Example:**\n\n```csharp\nBenchmarkAutoRunner.Run\u003cJsonSerializersBenchmark\u003e(); //Prefer to use BenchmarkAutoRunner instead of BenchmarkRunner\n\n//Export to colorful image\n[RichImageExporter(\n    title: \"Json Serializers Benchmark\", \n    groupByColumns: [\"Method\"],             // Groups by 'Method' column and highlights groups\n    spectrumColumns: [\"Mean\", \"Allocated\"], // Colorizes 'Mean' and 'Allocated' columns as Spectrum and Sorts the result by them \n    //format: ImageFormat.Webp or Jpeg      // You can set image format (Default is ImageFormat.Png)\n    //theme: Theme.Dark                     // Optional (Default is Dark)\n)]  \n\n//Export to feature-rich HTML\n[RichHtmlExporter(\n    title: \"Json Serializers Benchmark\", \n    groupByColumns: [\"Method\"],             // Groups by 'Method' column and highlights groups\n    spectrumColumns: [\"Mean\", \"Allocated\"]  // Colorizes 'Mean' and 'Allocated' columns as Spectrum and Sorts the result by them \n    //sortByColumns: [\"Mean\", \"Allocated\"]  // You can also sort by other columns as you wish\n    //theme: Theme.Dark                     // Optional (Default is Dark)\n)]\n\n[MemoryDiagnoser(displayGenColumns: false)] // Displays Allocated column (without GC per Generation columns (Gen 0, Gen 1, Gen 2) due to false option)\npublic class JsonSerializersBenchmark { ... }\n```\n\n**Output:**\n\nTo see the results, navigate to the following path:\n\n`[ProjectDirectory]\\bin\\[Debug|Release]\\[.NET-version]\\BenchmarkDotNet.Artifacts\\results\\Benchmark-report-rich.html|png`\n\n**For Example:**\n\n- `MyBenchmark\\bin\\Release\\net8.0\\BenchmarkDotNet.Artifacts\\results\\Benchmark-report-rich.png`\n- `MyBenchmark\\bin\\Release\\net8.0\\BenchmarkDotNet.Artifacts\\results\\Benchmark-report-rich.html`\n\n### Using JoinReports method to Join and Pivot your reports\n\n**Example:**\n\n**Performance benchmark between for, foreach, and ForEach() in different versions of .NET**\n\n#### Pivot by Method column\n\n```csharp\nvar summary = BenchmarkAutoRunner.Run\u003cIterationBenchmark\u003e(); //Prefer to use BenchmarkAutoRunner instead of BenchmarkRunner\n\n//[ProjectDirectory]\\Reports\\JoinedBenchmark-PivotBy-Method-Dark.html\nvar htmlPath = DirectoryHelper.GetPathRelativeToProjectDirectory(@\"Reports\\JoinedBenchmark-PivotBy-Method-Dark.html\");\n\n//[ProjectDirectory]\\Reports\\JoinedBenchmark-PivotBy-Method-Dark.png\nvar imagePath = DirectoryHelper.GetPathRelativeToProjectDirectory(@\"Reports\\JoinedBenchmark-PivotBy-Method-Dark.png\");\n\nvar options = new JoinReportHtmlOptions\n{\n    Title = \"Performance Comparison between for, foreach, and ForEach() method\",\n    MainColumn = \"Runtime\",\n    GroupByColumns = [\"Categories\", \"Length\"],           // Groups by column 'Categories' and 'Length'\n    PivotColumn = \"Method\",                              // Pivot 'Method' column per value of 'Mean'\n    StatisticColumns = [\"Mean\"],                         // Colorizes 'Mean' columns as Spectrum\n    ColumnsOrder = [\"for\", \"foreach\", \"ForEach()\"],      // Order of columns\n    DividerMode = RenderTableDividerMode.SeparateTables, // Separates tables by Grouping by 'GroupByColumns'\n    HtmlWrapMode = HtmlDocumentWrapMode.RichDataTables,  // Uses feature-rich https://datatables.net plugin\n    Theme = Theme.Dark                                   // Optional (Default is Dark)\n};\n\nawait summary.JoinReportsAndSaveAsHtmlAndImageAsync(htmlPath, imagePath, options);\n```\n\n**Output HTML:**\n\nVisit [this HTML page](https://mjebrahimi.github.io/BenchmarkDotNetVisualizer/docs/iteration-benchmark1.html) at `samples/IterationBenchmark/Reports/JoinedBenchmark-PivotBy-Method-Dark.html`\n\n**Output Image:**\n\n![Iteration Benchmark](https://raw.githubusercontent.com/mjebrahimi/BenchmarkDotNetVisualizer/master/samples/IterationBenchmark/Reports/JoinedBenchmark-PivotBy-Method-Dark.png)\n\n#### Pivot by .NET Runtime column\n\n```csharp\nvar summary = BenchmarkAutoRunner.Run\u003cIterationBenchmark\u003e(); //Prefer to use BenchmarkAutoRunner instead of BenchmarkRunner\n\n//[ProjectDirectory]\\Reports\\JoinedBenchmark-PivotBy-Runtime-Dark.html\nvar htmlPath = DirectoryHelper.GetPathRelativeToProjectDirectory(@\"Reports\\JoinedBenchmark-PivotBy-Runtime-Dark.html\");\n\n//[ProjectDirectory]\\Reports\\JoinedBenchmark-PivotBy-Runtime-Dark.png\nvar imagePath = DirectoryHelper.GetPathRelativeToProjectDirectory(@\"Reports\\JoinedBenchmark-PivotBy-Runtime-Dark.png\");\n\nvar options = new JoinReportHtmlOptions\n{\n    Title = \"Performance Comparison between for, foreach, and ForEach() method\",\n    MainColumn = \"Method\",\n    GroupByColumns = [\"Categories\", \"Length\"],           // Groups by column 'Categories' and 'Length'\n    PivotColumn = \"Runtime\",                             // Pivot 'Runtime' column per value of 'Mean'\n    StatisticColumns = [\"Mean\"],                         // Colorizes 'Mean' columns as Spectrum\n    ColumnsOrder = [\".NET Core 3.0\", \".NET Core 3.1\", \".NET 5.0\", \".NET 6.0\", \".NET 7.0\", \".NET 8.0\"], //Order of columns\n    DividerMode = RenderTableDividerMode.SeparateTables, // Separates tables by Grouping by 'GroupByColumns'\n    HtmlWrapMode = HtmlDocumentWrapMode.RichDataTables,  // Uses feature-rich https://datatables.net plugin\n    Theme = Theme.Dark                                   // Optional (Default is Dark)\n};\n\nawait summary.JoinReportsAndSaveAsHtmlAndImageAsync(htmlPath, imagePath, options);\n```\n\n**Output HTML:**\n\nVisit [this HTML page](https://mjebrahimi.github.io/BenchmarkDotNetVisualizer/docs/iteration-benchmark2.html) at `samples/IterationBenchmark/Reports/JoinedBenchmark-PivotBy-Runtime-Dark.html`\n\n**Output Image:**\n\n![Iteration Benchmark](https://raw.githubusercontent.com/mjebrahimi/BenchmarkDotNetVisualizer/master/samples/IterationBenchmark/Reports/JoinedBenchmark-PivotBy-Runtime-Dark.png)\n\n## Todo\n\n- [ ] Chart Visualization\n\n## Contributing\n\nCreate an [issue](https://github.com/mjebrahimi/BenchmarkDotNetVisualizer/issues/new) if you find a BUG or have a Suggestion or Question.\n\nIf you want to develop this project :\n\n1. Fork it!\n2. Create your feature branch: `git checkout -b my-new-feature`\n3. Commit your changes: `git commit -am 'Add some feature'`\n4. Push to the branch: `git push origin my-new-feature`\n5. Submit a pull request\n\n## Give it a Star! ⭐️\n\nIf you find this repository useful and like it, why not give it a star? if not, never mind! :)\n\n## License\n\nCopyright © 2024 [Mohammad Javad Ebrahimi](https://github.com/mjebrahimi) under the [MIT License](https://github.com/mjebrahimi/BenchmarkDotNetVisualizer/LICENSE).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmjebrahimi%2Fbenchmarkdotnetvisualizer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmjebrahimi%2Fbenchmarkdotnetvisualizer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmjebrahimi%2Fbenchmarkdotnetvisualizer/lists"}