npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

avtimer

v1.0.0

Published

Multiple timers in single instance to measure repetitive events performance

Downloads

5

Readme

avTimer

Multiple timers in single instance to measure repetitive events performance

usage

Grab it from npm and use with your favorite bundler:

npm install avtimer --save

Or download from CDN:

<script src='https://cdn.rawgit.com/anvaka/avtimer/v1.0.0/dist/avtimer.min.js'></script>

If you downloaded from CDN the library will be available under avTimer global name.

// Give your timer a friendly name:
var stopIteratorTimer = avTimer('Iterate over binary tree');

// do some work here. E.g. iterate over tree. When you are done, stop the timer:
stopIteratorTimer();

// This will print all timers that you've created, along with how many times
// each timer was called, how much time was spent total, and what's the average
// time cost per operation
avTimer.print();

// Prints:
//
// Iterate over binary tree called 1500 times and took 3612.345ms total.
// That is 2.408per call on average

// You can also print individual timers, by passing name:
avTimer.print('Iterate over binary tree');

Motivation

Most of the time using performance profiling tools in your favorite browser should be better than using this library. However this library can be useful if you want to track performance of two code branches, that call shared functionality.

In my case I needed to traverse quad tree in multiple code paths, multiple event loop cycles. I was not sure which code path was more expensive. Performance profiler was showing that tree iterator was the slowest, but I couldn't figure out which code path to keep.

license

MIT