Code Monkey home page Code Monkey logo

Comments (4)

mattwarren avatar mattwarren commented on May 18, 2024

yeah, I need to give [Params] a bit more love, it's too basic at the moment, but I just wanted to get something out there.

I agree, do you mean something like this:

[Params(typeof(ParamsData))]
public int Size = 1;

public class ParamsData : IEnumerable<int>
{
    public IEnumerator<int> GetEnumerator()
    {
        // Create the IEnumerable<int> however you want
    }

    System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
    {
        return this.GetEnumerator();
    }    
}

also I was thinking of adding this, what do you think?

[ParamsWithSteps(start: 1, end: 1000, step: 10)]
public int Size = 1;

which would basically do the following:

for (int i = 1, i <= 1000; i += 10)
{
    // run benchmark with Size = i
}

from benchmarkdotnet.

redknightlois avatar redknightlois commented on May 18, 2024

I would go with a simplier interface with a method that returns IEnumerable<T> but yeah, that's the idea.

With ParamsWithSteps I would go further and support inheritance and provide a few examples like:

[ParamsWithStep(start: 1, end: 1000, step: 10, inclusive: true)
[ParamsQuadratic(start: 1, end: 1000, inclusive: false)
[ParamsPowerOf(start: 1, end: 1024, power: 2, inclusive: true)

from benchmarkdotnet.

mattwarren avatar mattwarren commented on May 18, 2024

I would go with a simplier interface with a method that returns IEnumerable<T> but yeah, that's the idea.

Yeah I agree, I've just seen that XUnit simplified everything, so you can now support method/fields or classes via [MemberData(..)], see https://xunit.codeplex.com/SourceControl/changeset/628af664e521543c2c9d712b45d0d870f2a84d26

With ParamsWithSteps I would go further and support inheritance and provide a few examples like:

Nice idea, I'd not thought about Quadratic/PowerOf

from benchmarkdotnet.

adamsitnik avatar adamsitnik commented on May 18, 2024

It will be tracked as part of #256

from benchmarkdotnet.

Related Issues (20)

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.