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

wyrd

v0.1.3

Published

A tool for measuring performance of specific areas or functions in your application for a specific time bucket.

Downloads

2

Readme

Wyrd

Wyrd is a tool for measuring performance of specific areas or functions in your application for a specific time bucket.

Table of contents

What is a wyrd?

From Wikipedia;

Wyrd is a feminine noun, and its Norse cognate urðr, besides meaning "fate", is the name of one of the Norns; urðr is literally "that which has come to pass".

Motivation

In certain applications, for example a canvas application, there is often a need to discover how many times a function is called, or how much time on average is spent on that function. That is what this tool tries to solve. With this tool it is possible to iteratively identify the bottlenecks in your application.

Installing

Using npm:

npm install wyrd

Using yarn:

yarn add wyrd

Using unpkg CDN:

<script src="https://unpkg.com/wyrd/dist/index.umd.js"></script>

Example

note: ES Module example

Get the Wyrd object

import { Wyrd } from "wyrd";

Alternatively you can get measureManager object, which is the same object.

import { measureManager } from ".wyrd";

With this object you can register a measures.

Wyrd.registerMeasure("measure-some-action");

Around the function execution you can mark start and end

function someFn() {
    Wyrd.markMeasureStart("measure-some-action");
    // this is some repeating function that you'd like to know how much time 
    // it spent on average in a given time bucket
    actionToMeasure();
    Wyrd.markMeasureEnd("measure-some-action");
}

At any time in the console, you can access this measurement

    const results = Wyrd.getResults("measure-some-action");

The results are a list of TimeBucketResult . They can be logged in the console, or sent to be collected elsewhere.

A Measure can be accessed directly

    const measure = Wyrd.getMeasures("measure-some-action");

If a measure is no longer needed, it can be finished (in which case no further measurements will occur).

    let isFinished = Wird.getMeasure("measure-some-action").isFinished // should be false
    Wyrd.finishMeasure("measure-some-action");
    isFinished = Wird.getMeasure("measure-some-action").isFinished // should be true