Volver al ranking

micmro/performance-bookmarklet

JavaScript

Performance-Bookmarklet helps to analyze the current page through the Resource Timing API, Navigation Timing API and User-Timing - requests by type, domain, load times, marks and more. Sort of a light live WebPageTest.

webperfbookmarkletnavigation-timingresource-timinganalyzerperformancewaterfallrequestsperformance-metricsuser-timingbrowser-extension
Crecimiento de estrellas
Estrellas
1.2k
Forks
84
Crecimiento semanal
Issues
11
5001k
oct 2014sept 2018ago 2022jul 2026
Artefactosnpmnpm install performance-bookmarklet
README

Performance-Bookmarklet

Bookmarklet, Chrome Extension and Firefox add-on to analyze the current page through the Resource Timing API, Navigation Timing API and User-Timing - requests by type, domain, load times, marks and more - sort of a light live WebPageTest.

Just add this into the URL section of a new bookmark:

javascript:(function(){var el=document.createElement('script');el.type='text/javascript';el.src='https://micmro.github.io/performance-bookmarklet/dist/performanceBookmarklet.min.js';el.onerror=function(){alert("Looks like the Content Security Policy directive is blocking the use of bookmarklets\n\nYou can copy and paste the content of:\n\n\"https://micmro.github.io/performance-bookmarklet/dist/performanceBookmarklet.min.js\"\n\ninto your console instead\n\n(link is in console already)");console.log("https://micmro.github.io/performance-bookmarklet/dist/performanceBookmarklet.min.js");};document.getElementsByTagName('body')[0].appendChild(el);})();

You can use the Performance-Bookmarklet (renamed as Performance-Analyser since it's not a Bookmarklet) as Chrome Extension or Firefox add-on.

screenshot showing the whole bookmarklet on http://google.com

Bookmarklet Output in Detail

alt text

  • It also displays markers and measures if you're setting marks with the User Timing API (performance.mark and performance.measure)
  • Hover over the bars to see a tooltip with the exact Milliseconds/duration
Navigation Timing API Details


Diagram of the Navigation Timing API as seen on W3C site

Domain/Resource analysis

alt text

  • Requests by domain:
    • How many requests are added by 3rd parties - green wedges represent the current TLD and subdomains
    • Avg. Duration: the mean of all request of this domain
    • Duration Parallel: actual time a domain spends on the wire - de-duping parallel request duration
    • Duration Sum: simple sum of the duration of all requests of this domain
    • Percentage: the percentage of all requests coming from this domain
  • Requests by Initiator Type
  • Requests by Type - what content type is accountable for the majority of requests
  • Internal / extenal comparison charts
    external is currently everything except the current host - exluding sub domains

Resource Timing Waterfall with Markers

alt text

  • The small bars inside the resource bar represent the different stages of the request (redirect, domainLookup, connect, secureConnect, requestToResponseStart, response), but are mostly unavailable for cross-domain requests.
  • The resource bar colours indicates the initiatorType
  • You can filter the waterfall chart by domain
Resource Timing API Details


Diagram of the Resource Timing API as seen on W3C site

Console Output

The bookmarklet also outputs various console tables (where supported) to analyze the data in detail.

alt text

Various page metrics can be persisted between page refreshes and later displayed in the console, when ticking the Persist Data? checkbox.

How to use this snippet

You can use it as bookmarklet. Mozilla has a step by step description on how to add a bookmarklet.

javascript:(function(){var el=document.createElement('script');el.type='text/javascript';el.src='https://micmro.github.io/performance-bookmarklet/dist/performanceBookmarklet.min.js';el.onerror=function(){alert("Looks like the Content Security Policy directive is blocking the use of bookmarklets\n\nYou can copy and paste the content of:\n\n\"https://micmro.github.io/performance-bookmarklet/dist/performanceBookmarklet.min.js\"\n\ninto your console instead\n\n(link is in console already)");console.log("https://micmro.github.io/performance-bookmarklet/dist/performanceBookmarklet.min.js");};document.getElementsByTagName('body')[0].appendChild(el);})();

Or alternatifly just copy and paste the content of performanceBookmarklet.js to your browser console.

You need to fall back to the browser extension or the copy and paste version for sites that block external scripts in their Content Security Policy directives.

Browser Extensions

performance-bookmarklet can also be used as Chrome Extension and Firefox add-on. It uses the same code, but has some usability advantages, e.g. you don't need to worry about the Content Security Policy directives.

Read more

Repositorios relacionados
davidsonfellipe/awesome-wpo

A curated list of Web Performance Optimization.

MIT Licenseawesome-listawesome
awesome-wpo.dev
9k579
GoogleChrome/lighthouse-ci

Automate running Lighthouse for every commit, viewing the changes, and preventing regressions

JavaScriptnpmApache License 2.0lighthousewebperf
7k710
sitespeedio/sitespeed.io

sitespeed.io is an open-source tool for comprehensive web performance analysis, enabling you to test, monitor, and optimize your website’s speed using real browsers in various environments.

JavaScriptnpmMIT Licensewebmetrics
sitespeed.io
5k627
JamieMason/ImageOptim-CLI

Make optimisation of images part of your automated build process

TypeScriptnpmMIT Licenseimageoptimimage-optimisation
foldleft.io/image-tools
3.5k127
axe312ger/sqip

"SQIP" (pronounced \skwɪb\ like the non-magical folk of magical descent) is a SVG-based LQIP technique.

TypeScriptnpmThe Unlicensewebperfwebperformance
sqip.vercel.app
3.4k86
macbre/phantomas

Headless Chromium-based web performance metrics collector and monitoring tool

JavaScriptnpmBSD 2-Clause "Simplified" Licensephantomasmetrics
npmjs.com/package/phantomas
2.3k136
rx-angular/rx-angular

Reactive Extensions for Angular.

TypeScriptnpmMIT Licenseangularperformance
rx-angular.io
2k208
nucliweb/webperf-snippets

⚡️ 💾 Web Performance Snippets

JavaScriptnpmMIT Licenseperformanceperformance-analysis
webperf-snippets.nucliweb.net
1.4k86
wix/import-cost

displays the import size of the package you are importing inside the code editor

JavaScriptnpmMIT Licensevscodeperformance
marketplace.visualstudio.com/items
1.4k70
malchata/yall.js

A fast, flexible, and small SEO-friendly lazy loader.

JavaScriptnpmMIT Licenselazy-loadingwebperf
1.4k136
paulirish/pwmetrics

Progressive web metrics at your fingertipz

TypeScriptnpmApache License 2.0metricsperformance
1.2k69