Socket
Book a DemoInstallSign in
Socket

pagespeed-benchmark

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pagespeed-benchmark

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

0.0.14
latest
Source
npmnpm
Version published
Weekly downloads
14
180%
Maintainers
1
Weekly downloads
 
Created
Source

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()

Keywords

pagespeed

FAQs

Package last updated on 11 Sep 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.