Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<li><a href="many-redirects/index.html">many-redirects</a></li>
<li><a href="minified-with-source-maps/index.html">minified-with-source-maps</a></li>
<li><a href="nested-interactions/index.html">nested-interactions</a></li>
<li><a href="nested-user-timings/index.html">nested-user-timings</a></li>
<li><a href="node-fib-app/index.html">node-fib-app</a></li>
<li><a href="react-hello-world/index.html">react-hello-world</a></li>
<li><a href="scheduler/index.html">scheduler</a></li>
Expand Down
7 changes: 7 additions & 0 deletions nested-user-timings/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# user-timings

This example creates some performance measures:

1. `first measure` from 0-200ms
2. `second measure` from 0-600ms
3. `third measure` from 1000-2000ms
56 changes: 56 additions & 0 deletions nested-user-timings/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
function consecutiveNonOverlapping() {
const name = 'ConsecutiveNonOverlapping';
const start = performance.now();

performance.measure(name, {
start: start,
end: start + 500,
});
performance.measure(name, {
start: start + 500,
end: start + 1000,
});
}

function overlappingNonNested() {
const name = 'OverlappingNonNested';
const start = performance.now();

performance.measure(name, {
start: start,
end: start + 500,
});
performance.measure(name, {
start: start + 100,
end: start + 600,
});
}

function overlappingNested() {
const name = 'OverlappingNested';
const start = performance.now();

performance.measure(name, {
start: start,
end: start + 500,
});
performance.measure(name, {
start: start + 100,
end: start + 200,
});
}

setTimeout(() => {
consecutiveNonOverlapping();
}, 100);

setTimeout(() => {
overlappingNonNested();
}, 2000);

setTimeout(() => {
overlappingNested();

const text = document.createTextNode('Finished!');
document.body.appendChild(text);
}, 3000);
9 changes: 9 additions & 0 deletions nested-user-timings/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<html>
<head>
<title>User Timings</title>
<style></style>
</head>
<body>
<script src="app.js"></script>
</body>
</html>