Giter VIP home page Giter VIP logo

breaking-point's Introduction

breaking-point.py

breaking-point.py helps to find a size of input data where one function starts outperform another function. It is a convenient way to compare different algorithms for a single task.

INSTALLATION

pip install breaking-point

USAGE

from breaking_point import find_breaking_point

find_breaking_point(f1, f2, input_generator, start=1, step=1, limit=1000000, trial_count=1000, repeat_count=3)

there

  • f1, f2 - functions to compare.
  • inpurt_generator - function that takes n argument (size of input on current iteration) and returns input data for f1 and f2. Return value should be a tuple with first element - list of non-keyworded arguments and second element - dict of keyword arguments.
  • start - initial input data size.
  • step - step of iteration.
  • limit - maximum amount of input data. If breaking point was not found until limit was reached - iteration stops.
  • trial_count - number of executions with each input data size.
  • repeat_count - repeat trial several times and use average performance result.

Function returns n0 - size of input data for which f2(n0) executed faster than f1(n0) or None if reaches limit.

EXAMPLE

See example.py.

LICENSE

MIT

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.