Giter VIP home page Giter VIP logo

timer.js's Introduction

timer.js is a JavaScript library that implements a constructor for creating high-resolution (up to µs) timers.

Please note that the microseconds() method is only accurate to the µs in Google Chrome 7+ with the launch option, --enable-benchmarking.

API

new Timer()
Instantiates a new timer.

Instance methods

timer.start()
Starts the timer.
timer.stop()
Stops the timer.
timer.seconds()
Returns the amount of time, in seconds, that have passed after starting the timer, and up to stopping the timer if it has been stopped.
timer.milliseconds()
Same as timer.seconds(), but returns milliseconds.
timer.microseconds()
Same as timer.seconds(), but returns microseconds.
timer.profile(test, iterations)
Profiles running a function the amount of iterations specified with the timer.

FAQ

Will you add support for web worker threads so I profile multiple tests concurrently?

I don't know how practical running two profiling tests at once is, but if demand is high enough, I'll make a web worker integration script for this library. The API would mostly be the same, except that profiled code will have to be strings instead of functions, and there would be callback parameters for all of the methods.

Tracking image

timer.js's People

Contributors

eligrey avatar

Watchers

Arthur Park avatar James Cloos 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.