Giter Club home page Giter Club logo

lambdamicrobenchmarking's Introduction

LambdaMicrobenchmarking: microbenchmarking tool for C# and F#.

Build status NuGet NuGet total

LambdaMicrobenchmarking is a library for microbenchmarking orchestration in C# and F#. The programer can measure the execution performance of thunks (lambdas with no arguments).

Func<long> sumLinq       = () => v.Sum();
Func<long> sumSqLinq     = () => v.Select(x => x * x).Sum();
Func<long> sumSqEvenLinq = () => v.Where(x => x % 2 == 0).Select(x => x * x).Sum();
Func<long> cartLinq      = () => (from x in vHi
                                  from y in vLow
                                  select x * y).Sum();
Script.Of("sumLinq", sumLinq)
      .Of("sumSqLinq", sumSqLinq)
      .Of("sumSqEvensLinq", sumSqEvenLinq)
      .Of("cartLinq", cartLinq)
      .WithHead()
      .RunAll();

The corresponding script for F#:

Script.Of("sumLinq", Func<int64> sumLinq)
      .Of("sumOfSquaresLinq", Func<int64> sumSqLinq)
      .Of("sumOfSquaresEvenLinq", Func<int64> sumSqEvenLinq)
      .Of("cartLinq", Func<int64> cartLinq)
      .WithHead()
      .RunAll |> ignore

Sample output:

Benchmark          Mean      Mean-Error  Sdev  Unit
sumLinq          98.324           0.543 0.359 ms/op
sumSqLinq       224.831           1.804 1.193 ms/op
sumSqEvenLinq    82,789           5,729 3,789 ms/op
cartLinq        200,775           6,477 4,284 ms/op

* the statistics part is inspired by JMH (AbstractStatistics, ListStatistics).

References

Contributing

Sending PRs and participating in the discussion for improving LM is highly encouraged. Our goal is to create a tool for .NET that produces valid results, giving real control over the intented experiments.

lambdamicrobenchmarking's People

Contributors

biboudis avatar fbie avatar mart-bogdan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

lambdamicrobenchmarking's Issues

[Proposal] Run configurations

add configuration variable for following

  1. Should we run GC between iterations
  2. How many times we have to run single benchmark (N )
  3. somethig else?

Discussion about API

I'd like to add Action benchmarks in addition to Function< T > benchmarks.

I guess that should be alternative class for that, or perhaps, just overloaded method?

In most cases void method is enought for benchmarking. Additional values can be feed to "Copiler.ConsumeValue"

I'd like to implement this, but I'd prefer we to discuss this first.

P.S. I'm studying 1st grade students and would like them to use this to benchmarks sortig algorithms, data structures, etc.

[Proposal] Add "SetUp" method

I'd like to add method for user to specify callback to clan resources between runs.

            Script.Of(
                Tuple.Create("sumLinq",   sumLinq),
                Tuple.Create("sumSqLinq", sumSqLinq),
                Tuple.Create("sumSqEvensLinq", sumSqEvenLinq),
                Tuple.Create("cartLinq", cartLinq))
                .SetUp(()=>collection.Reset())
                .RunAll();

Perhaps different methods to run between differnt benchmarks and runs of single Benchmark.

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.