Giter Club home page Giter Club logo

benchly's Introduction

📊 benchly

Use Benchly to automatically export graphical BenchmarkDotNet results without installing additional tools such as R. Benchly runs seamlessly as part of benchmark execution and is compatible with GitHub actions. Benchly produces high quality charts using Plotly.NET.

NuGet version Nuget

Benchly supports 4 different plots:

  • Column chart: shows the relative latency of results.
  • Box plot: shows the relative variability of results.
  • Histogram: shows distribution of results.
  • Timeline: shows the latency trend through time.

Getting started

Benchly is installed from NuGet:

dotnet add package Benchly

Annotate benchmarks

Add plot exporter attributes to your benchmark:

    [BoxPlot(Title = "Box Plot", Colors = "skyblue,slateblue")]
    [ColumnChart(Title = "Column Chart", Colors = "skyblue,slateblue")]
    [MemoryDiagnoser, SimpleJob(RuntimeMoniker.Net60), SimpleJob(RuntimeMoniker.Net48)]
    public class Md5VsSha256
    {
        private const int N = 10000;
        private readonly byte[] data;

        private readonly SHA256 sha256 = SHA256.Create();
        private readonly MD5 md5 = MD5.Create();

        public Md5VsSha256()
        {
            data = new byte[N];
            new Random(42).NextBytes(data);
        }

        [Benchmark]
        public byte[] Sha256() => sha256.ComputeHash(data);

        [Benchmark]
        public byte[] Md5() => md5.ComputeHash(data);
    }

Plots are written to the results directory after running the benchmarks, like the built in exporters:

image

Benchly Benchmarks Md5VsSha256-boxplot Benchly Benchmarks Md5VsSha256-barplot

Under the hood

Benchly uses Plotly.NET. Ironically for a performance measurement tool, whilst convenient this is not a performant approach to generating plots. Internally, FSharp invokes plotly.js running inside a headless instance of chromium managed by pupetteer. The first time benchly runs, chromium will be downloaded into the bin directory causing short delay.

Credits

Based on this repo that shows how to export benchmark data to Excel: https://github.com/CodeTherapist/BenchmarkDotNetXlsxExporter

benchly's People

Contributors

bitfaster avatar

Stargazers

Niklas Petersen avatar いぬいぬ avatar  avatar Laurent Kempé avatar Felix Strauß avatar Kirill Osenkov avatar Reuben Bond avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.