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

Stargazers

Anne Thorpe avatar  avatar Mashy avatar Bryden Wayne avatar Ying Feng avatar  avatar  avatar Jon Repp avatar  avatar  avatar Edin Delan avatar Rick avatar  avatar Reece Butler avatar Kumarajiva avatar Xor avatar Sylvia JS avatar Andrew Prentice avatar Michael Anthony avatar bruce avatar Javier Maldonado avatar  avatar Benjamin Wasty avatar Brandon Burkeen avatar Rien avatar Jeff Greco avatar Barney Chen avatar Orange Mug avatar Jim Ing avatar trarck avatar Victor Gladkikh avatar James Baker avatar Mathias Bynens avatar Marijn Huizendveld avatar  avatar Lance Pollard avatar Sven Andersson avatar Brett Camper avatar Scott Taylor avatar Tom Beddard avatar

Watchers

 avatar James Cloos avatar Michael Anthony avatar  avatar

timer.js's Issues

npm module?

I know it's been a long while since you've made this, but would you consider publishing an npm module for this?

Web worker integration script

I’m not sure where else to post this, but I’d be grateful if you could add a web worker integration script for this library! 😁

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.