Giter VIP home page Giter VIP logo

Comments (3)

DigitalInBlue avatar DigitalInBlue commented on July 1, 2024

Without specifics, it is hard to answer your question precisely. Two ideas for an approach would be 1.) Use a fixture (reference celeroDemoSort) to create your input data and then simply use it in your benchmark. 2.) Baseline your test with creation of your input data. Then, in your benchmark case, create your input data and pass it into your function. The benchmark will then report how much MORE time it takes to process the data vs. create it. I'm sure there are other approaches as well, but these should help get you started.

from celero.

Gluttton avatar Gluttton commented on July 1, 2024

Thanks for you answer!

Without specifics, it is hard to answer your question precisely.

My problem can be described with code snippets in the following way (very simplified):

    // 1. I have class which implements the solving of the assignment problem.
    Munkres algorithm;
    // 2. Input data which presented as matrix need to be passed in this class by reference.
    Matrix data {
        { 2.0,  4.0},
        { 3.0,  7.0}
    }
    // 3. When the class solves the task it puts solution in the passed matrix (in other words it modifies the matrix in the place).

    algorithm.solve (data);

    // And wow matrix contain modified data,
    //Matrix data {
    //    {-1.0,  0.0},
    //    { 0.0, -1.0}
    //}
    // so if I try to relaunch:
    //algorithm.solve (data);
    // it will get wrong input data.

The actual code can be viewed here.

1.) Use a fixture (reference celeroDemoSort) to create your input data and then simply use it in your benchmark.

I've already use it, for other purpose: change input data after each run (first run I use matrix 3x3, next - 10x10, etc). But anyway using Fixtures can't help me because it calls each run, but I need some method which is launched for each iteration.

2.) Baseline your test with creation of your input data. Then, in your benchmark case, create your input data and pass it into your function.

This approach has the same problem.

Thanks for your attention one more time! But I looks like I need something else solution.

from celero.

Gluttton avatar Gluttton commented on July 1, 2024

User @nickbruun has proposed in the similar issue use a fixture and then do a number of one iteration runs. This solution is exactly what I need.

PS. Thanks a lot for your free and useful tool!

from celero.

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.