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

pmat

v1.0.3

Published

🚀 A analysis tool for performance measurement

Downloads

11

Readme

English | 中文

Install

npm install d -g pmat

# or use yarn:
# yarn global add pmat

The output

Notice: It loaded .... the period means This test takes time. So -n go up and the period go up. but after you measure TTI, try to keep count below 5, because it will take a lot of time.

PerformanceNavigationTiming

| Key | Value | | :------------------------ | :---------------------------------------------------- | | Duration time | duration | | Redirect time | redirectEnd - redirectStart | | App cache time | domainLookupStart - fetchStart | | DNS lookup time | domainLookupEnd - domainLookupStart | | TCP connect time | connectEnd - connectStart | | Time To First Byte time | responseStart - requestStart | | Download time of the page | responseEnd - responseStart | | Fetch resource time | responseEnd - fetchStart | | White screen time | domInteractive - fetchStart | | DOM Ready time | domContentLoadedEventEnd - fetchStart | | DOM Content Load time | domContentLoadedEventEnd - domContentLoadedEventStart |

https://developer.mozilla.org/en-US/docs/Web/API/PerformanceNavigationTiming

Metric

| Key | Value | | :-- | :----------------------- | | FP | First Paint | | FCP | First Content Paint | | LCP | Largest Contentful Paint | | CLS | Cumulative Layout Shift | | FID | First Input Delay | | TBT | Total Blocking Time | | TTI | Time to Interactive |

Usage

pmat --help

Usage: pmat [options] [url]

🚀 A analysis tool for performance measurement

Options:

   -v, --version                output the version number
   -n, --count <n>              specified loading times (default: 20)
   -u, --useragent <ua>         to set the useragent
   --no-cache                   disable cache (default: false)
   --no-javascript              disable javascript (default: false)
   --no-online                  disable network (defalut: false)
   -h, --help                   output usage information

For instance

 # We can omit the protocol header if has omitted, the protocol header will be `https://`

 # The simplest usage
 pmat taobao.com

 # if the url has any parameter, surround the url with double quotes
 pmat "taobao.com?a=1&b=2"

 #  Load the specified page 100 times
 pmat -n 5 "taobao.com?a=1&b=2"

 #  Load the specified page 100 times without `cache`
 pmat -n 5 "taobao.com?a=1&b=2" --no-cache

 #  Load the specified page 100 times without `javascript`
 pmat -n 5 "taobao.com?a=1&b=2" --no-javascript

 #  Load the specified page 100 times with `headless = false`
 pmat -n 5 "taobao.com?a=1&b=2" -H false

 #  Load the specified page 100 times with set `useragent`
 pmat -n 5 "baidu.com?a=1&b=2" -u "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36"

Pain point

After we have developed a project or optimized the performance of a project,

how do we measure the performance of this project?

A common approach is to look at the data in the performance and network in the Dev Tool, record a few key performance metrics, and refresh them a few times before looking at those performance metrics,

Sometimes we find that due to the small sample size, the current Network/CPU/Memory load is heavily impacted, and sometimes the optimized project is slower than before the optimization.

If there is a tool, request web page many times, and then taking out the various performance indicators averaging, we can very accurately know the optimization is positive or negative.

In addition, you can also make a comparison and get accurate data about how much you have optimized. This tool is designed to solve the pain point.

At the same time, this tool is also a good tool for us to learn about the "browser's process of load and rendering" and "performance optimization", so that we don't get wrong conclusions when there are too few samples

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

License

MIT

Welcome Star and PR

Copyright (c) 2018 [email protected]