Skip to content

Instantly share code, notes, and snippets.

@npm1
npm1 / interactionID.md
Last active December 14, 2021 08:22
Interaction ID Explainer

Interaction ID

Nicolás Peña Moreno

Hongbo Song

Introduction

Currently, developers can measure the latency of an event using the Event Timing API. Developers may query the duration, which returns the next paint after event handlers have run. Or they may compute the input delay, the delta between startTime (the event's timeStamp) and processingStart, which is a timestamp taken right before event is dispatched. But measuring event latency separately can’t help developers fully understand the user’s pain. When a user interacts with a web page, a user interaction (i.e. click/tap, press a key, drag) usually triggers a sequence of events. For example, when the user c

@npm1
npm1 / gist:7f530e176c66258e83fc27a62b6032ec
Created January 30, 2018 21:29
Buckets: 4 seconds vs 30 seconds
Current values, im microseconds (up to 4 seconds):
1
2
3
4
5
7
10
14
19
@npm1
npm1 / longtasks-eqt.js
Last active December 7, 2017 18:49
LongTasks EQT estimator
let longTaskObserver, beginTime, endTime;
let taskDurations = [];
function begin() {
longTaskObserver = new PerformanceObserver(function(entryList) {
const entries = entryList.getEntries();
for (let i = 0; i < entries.length; i++) {
taskDurations.push(entries[i].duration);
}
});
beginTime = performance.now();
This is a testharness.js-based test.
PASS First loop: checking entries after removing "". There should be 2 entries.
PASS First loop: checking entries after removing "". Entries in entrylist should be in order.
PASS First loop: checking entries after removing "". Entry_list 0. Entry "1" should be one that we have set.
PASS First loop: checking entries after removing "". Entry_list 0. entryType should be "mark".
PASS First loop: checking entries after removing "". Entry_list 0. startTime should greater than 0.
PASS First loop: checking entries after removing "". Entry_list 0. duration of mark should be 0.
PASS First loop: checking entries after removing "". Entry_list 1. Entry "abc" should be one that we have set.
PASS First loop: checking entries after removing "". Entry_list 1. entryType should be "mark".
PASS First loop: checking entries after removing "". Entry_list 1. startTime should greater than 0.