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

pagespeed-benchmark

v0.0.14

Published

Lighthouse benchmark is a tool to run [Lighthouse](https://github.com/GoogleChrome/lighthouse) pagespeed test multiple times on multiple urls and display statistics.

Downloads

35

Readme

Lighthouse benchmark

Lighthouse benchmark is a tool to run Lighthouse pagespeed test multiple times on multiple urls and display statistics.

When trying to improve your pagespeed score you might want to check to see the result of your changes. Lighthouse is a very good tool for that, but the variability in the result means you have to run the tool several times and use the median values to exclude extremes.

Run without installing using npx

npx pagespeed-benchmark https://www.github.com/ -n 5

This will download the latest version of this tool every time you run it. Including a 100+ MB chromium browser.

Installing locally

npm i -g pagespeed-benchmark

pagespeed-benchmark https://www.github.com/ -n 5

Output

This is an example of what the output looks like

> node cli https://example.com/ -n 10

Number of requests per url: 10
Processing url: https://example.com/

https://example.com/

metric                   median  average  min     max
-----------------------  ------  -------  ------  ------
performance                 100      100     100     100
server-response-time        113      116     101     142
first-contentful-paint      860      856     818     891
first-meaningful-paint      860      856     818     891
largest-contentful-paint   9661     9715    9405   10049
speed-index                1148     1129    1006    1216
interactive                 873      870     818     999
first-cpu-idle              860      865     818     974
estimated-input-latency    12.8     12.8    12.8    12.8
max-potential-fid          16.0     36.6    16.0   142.0
main-thread-tasks           2.5      2.5     2.0     3.0
transfer-size               850      850     849     850
request-count                 1        1       1       1
dom-elements                  5        5       5       5
accessibility                88       88      88      88
best-practices              100      100     100     100
seo                          90       90      90      90
pwa                          48       48      48      48

From another script

First install the package

npm i pagespeed-benchmark

And then something like this in your code

const pagespeedBenchmark = require('pagespeed-benchmark')

const urls = [
  'https://example.com/',
  'https://www.npmjs.com/',
]

const requestsPerUrl = 3

const run = async () => {
  for await (const url of urls) {
    console.log('Processing url:', url)

    const urlStatistics = await pagespeedBenchmark(url, requestsPerUrl)

    console.log()

    for (const [metric, data] of Object.entries(urlStatistics)) {
      console.log(metric, data.median)
    }

    console.log()
    console.log()
  }
}

run()