All Projects → w3c → performance-timeline

w3c / performance-timeline

Licence: other
Performance Timeline

Programming Languages

HTML
75241 projects

Projects that are alternatives of or similar to performance-timeline

Navigation Timing
Navigation Timing
Stars: ✭ 92 (-9.8%)
Mutual labels:  web-application, performance-metrics, specification, webapp
hr-time
High Resolution Time
Stars: ✭ 43 (-57.84%)
Mutual labels:  web-application, specification, webapp
servant-beam-realworld-example-app
Exemplary fullstack Medium.com clone powered by Servant and Beam
Stars: ✭ 33 (-67.65%)
Mutual labels:  web-application, webapp
Alumna
[Alpha release of v3] Development platform for humans / Plataforma de desenvolvimento para humanos
Stars: ✭ 32 (-68.63%)
Mutual labels:  web-application, webapp
Theorytracker
🎼 HTML5/WebAudio multi-track functional harmony analysis and songwriting app! -- https://hlorenzi.github.io/theorytracker/
Stars: ✭ 62 (-39.22%)
Mutual labels:  web-application, webapp
Longtasks
Long Task API
Stars: ✭ 193 (+89.22%)
Mutual labels:  specification, webapp
SyncPaint
A web app for synchronized group drawing. Draw together with other people in real time.
Stars: ✭ 42 (-58.82%)
Mutual labels:  web-application, webapp
Start Fastapi
a lightweight web framework based on fastapi
Stars: ✭ 48 (-52.94%)
Mutual labels:  web-application, webapp
Sharry
Sharry is a self-hosted file sharing web application.
Stars: ✭ 170 (+66.67%)
Mutual labels:  web-application, webapp
Node Red Contrib Uibuilder
Easily create data-driven web UI's for Node-RED using any (or no) front-end library. VueJS and bootstrap-vue included but change as desired.
Stars: ✭ 215 (+110.78%)
Mutual labels:  web-application, webapp
workflowmanager-viewer-js
Source code for ArcGIS Workflow Manager JavaScript viewer - Manage your workflows on the web.
Stars: ✭ 23 (-77.45%)
Mutual labels:  web-application, webapp
Musicode
🎶 Markup language for music creation and analysis! -- https://hlorenzi.github.io/musicode/
Stars: ✭ 34 (-66.67%)
Mutual labels:  web-application, webapp
System Design Primer
Learn how to design large-scale systems. Prep for the system design interview. Includes Anki flashcards.
Stars: ✭ 154,659 (+151526.47%)
Mutual labels:  web-application, webapp
Webperl
Run Perl in the browser with WebPerl!
Stars: ✭ 221 (+116.67%)
Mutual labels:  web-application, webapp
Online-Food-Ordering-Web-App
Online Food Ordering System Website using basic PHP, SQL, HTML & CSS. You can use any one of XAMPP, WAMP or LAMP server to run the Web App
Stars: ✭ 96 (-5.88%)
Mutual labels:  web-application, webapp
gamma-astro-data-formats
Data formats for gamma-ray astronomy
Stars: ✭ 24 (-76.47%)
Mutual labels:  specification
FC-Docker
Project to run FreeCAD in a cloud environment accessible via a web browser in a cloud environment.
Stars: ✭ 40 (-60.78%)
Mutual labels:  webapp
youtube-copy-annotations
💻 Copy YouTube annotations like a pro!
Stars: ✭ 13 (-87.25%)
Mutual labels:  webapp
sgce
Sistema Gerenciador de Certificados Eletrônicos (Projeto em Python/Django) - Django 2.0+ e Python3
Stars: ✭ 28 (-72.55%)
Mutual labels:  webapp
tksweb
Web-based timesheeting system that exports TKS files
Stars: ✭ 15 (-85.29%)
Mutual labels:  webapp

Performance Timeline

Overview

The PerformanceTimeline specification defines ways in which web developers can measure specific aspects of their web applications in order to make them faster. It introduces two main ways to obtain these measurements: via getter methods from the Performance interface and via the PerformanceObserver interface. The latter is the recommended way to reduce the performance impact of querying these measurements.

PerformanceEntry

A PerformanceEntry object can host performance data of a certain metric. A PerformanceEntry has 4 attributes: name, entryType, startTime, and duration. This specification does not define concrete PerformanceEntry objects. Examples of specifications that define new concrete types of PerformanceEntry objects are Paint Timing, User Timing, Resource Timing, and Navigation Timing.

Performance getters

The Performance interface is augmented with three new methods that can return a list of PerformanceEntry objects:

  • getEntries(): returns all of the entries available to the Performance object.
  • getEntriesByType(type): returns all of the entries available to the Performance object whose entryType matches type.
  • getEntriesByName(name, type): returns all of the entries available to the Performance object whose name matches name. If the optional parameter type is specified, it only returns entries whose entryType matches type.

Using the getters in JavaScript

The following example shows how getEntriesByName() could be used to obtain the first paint information:

// Returns the FirstContentfulPaint entry, or null if it does not exist.
function getFirstContentfulPaint() {
  // We want the entry whose name is "first-contentful-paint" and whose entryType is "paint".
  // The getter methods all return arrays of entries.
  const list = performance.getEntriesByName("first-contentful-paint", "paint");
  // If we found the entry, then our list should actually be of length 1,
  // so return the first entry in the list.
  if (list.length > 0)
    return list[0];
  // Otherwise, the entry is not there, so return null.
  else
    return null;
}

PerformanceObserver

A PerformanceObserver object can notified of new PerformanceEntry objects, according to their entryType value. The constructor of the object must receive a callback, which will be ran whenever the user agent is dispatching new entries whose entryType value match one of the ones being observed by the observer. This callback is not run once per PerformanceEntry nor immediately upon creation of a PerformanceEntry. Instead, entries are 'queued' at the PerformanceObserver, and the user agent can execute the callback later. When the callback is executed, all queued entries are passed onto the function, and the queue for the PerformanceObserver is reset. The PerformanceObserver initially does not observer anything: the observe() method must be called to specify what kind of PerformanceEntry objects are to be observed. The observe() method can be called with either an 'entryTypes' array or with a single 'type' string, as detailed below. Those modes cannot be mixed, or an exception will be thrown.

PerformanceObserverCallback

The callback passed onto PerformanceObserver upon construction is a PerformanceObserverCallback. It is a void callback with the following parameters:

  • entries: a PerformanceObserverEntryList object containing the list of entries being dispatched in the callback.
  • observer: the PerformanceObserver object that is receiving the above entries.
  • hasDroppedEntries: a boolean indicating whether observer is currently observing an entryType for which at least one entry has been lost due to the corresponding buffer being full. See the buffered flag section.

supportedEntryTypes

The static PerformanceObserver.supportedEntryTypes returns an array of the entryType values which the user agent supports, sorted in alphabetical order. It can be used to detect support for specific types.

observe(entryTypes)

In this case, the PerformanceObserver can specify various entryTypes values with a single call to observe(). However, no additional parameters are allowed in this case. Multiple observe() calls will override the kinds of objects being observed. Example of a call: observer.observe({entryTypes: ['resource', 'navigation']}).

observe(type)

In this case, the PerformanceObserver can only specify a single type per call to the observe() method. Additional parameters are allowed in this case. Multiple observe() calls will stack, unless a call to observer the same type has been made in the past, in which case it will override. Example of a call: observer.observe({type: "mark"}).

buffered flag

One parameter that can be used with observe(type) is defined in this specification: the buffered flag, which is unset by default. When this flag is set, the user agent dispatches records that it has buffered prior to the PerformanceObserver's creation, and thus they are received in the first callback after this observe() call occurs. This enables web developers to register PerformanceObservers when it is convenient to do so without missing out on entries dispatched early on during the page load. Example of a call using this flag: observer.observe({type: "measure", buffered: true}).

Each entryType has special characteristics around buffering, described in the registry. In particular, note that there are limits to the numbers of entries of each type that are buffered. When the buffer of an entryType becomes full, no new entries are buffered. A PerformanceObserver may query whether an entry was dropped (not buffered) due to the buffer being full via the hasDroppedEntry parameter of its callback.

disconnect()

This method can be called when the PerformanceObserver should no longer be notified of entries any more.

takeRecords()

This method returns a list of entries that have been queued for the PerformanceObserver but for which the callback has not yet run. The queue of entries is also emptied for the PerformanceObserver. It can be used in tandem with disconnect() to ensure that all entries up to a specific point in time are processed.

Using the PerformanceObserver

The following example logs all User Timing, Resource Timing entries by using a PerformanceObserver which observers marks and measures.

// Helper to log a single entry.
function logEntry(entry => {
  const objDict = {
    "entry type":, entry.entryType,
    "name": entry.name,
    "start time":, entry.startTime,
    "duration": entry.duration
  };
  console.log(objDict);
});

const userTimingObserver = new PerformanceObserver(list => {
  list.getEntries().forEach(entry => {
    logEntry(entry);
  });
});

// Call to log all previous and future User Timing entries.
function logUserTiming() {
  if (!PerformanceObserver.supportedEntryTypes.includes("mark")) {
    console.log("Marks are not observable");
  } else {
    userTimingObserver.observe({type: "mark", buffered: true});
  }
  if (!PerformanceObserver.supportedEntryTypes.includes("measure")) {
    console.log("Measures are not observable");
  } else {
    userTimingObserver.observe({type: "measure", buffered: true});
  }
}

// Call to stop logging entries.
function stopLoggingUserTiming() {
  userTimingObserver.disconnect();
}

// Call to force logging queued entries immediately.
function flushLog() {
  userTimingObserver.takeRecords().forEach(entry => {
    logEntry(entry);
  });
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].