Coder Social home page Coder Social logo

timepy's Introduction

TimePY

A simple python library to measure and display timings of your code.

Example usage

# initialize Controller
timeCtrl = TimeController()

# save times throughout the program
timeCtrl.addTime("start")
time.sleep(0.15)
timeCtrl.addTime("loaded file")
time.sleep(0.24)
timeCtrl.addTime("processed file")
time.sleep(0.10)
timeCtrl.addTime("saved file")

# print results
print(timeCtrl)  # default print
timeCtrl.print(unit='ms', decimals=3, show_deltas=False, show_notes=False)  # custom settings
timeCtrl.barChart()  # bar chart

Outputs

Default

[0]: 0.0s - "start"
(0.15s) 
[1]: 0.15s - "loaded file"
(0.24s) 
[2]: 0.39s - "processed file"
(0.1s) 
[3]: 0.49s - "saved file"

Custom settings

[0]: 0.0ms
[1]: 150.558ms
[2]: 390.892ms
[3]: 490.896ms

Bar chart

[1] loaded file (0.15s)     █████████████████████████
[2] processed file (0.24s)  ████████████████████████████████████████
[3] saved file (0.1s)       ████████████████▋

Efficiency

Each added time adds an overhead of about 0.6 nanoseconds. So TimePy should have no impact on performance for normal use cases. (see time_measure.py)

timepy's People

Contributors

imilchshake 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.