Skip to content

Instantly share code, notes, and snippets.

@shisama
Last active September 23, 2019 14:10
Show Gist options
  • Save shisama/c6fd101528e6573670c8ff876bea6f2e to your computer and use it in GitHub Desktop.
Save shisama/c6fd101528e6573670c8ff876bea6f2e to your computer and use it in GitHub Desktop.
<!doctype html>
<html>
<head>
</head>
<body>
<div id="info"></div>
<script>
const markerNameA = "example-marker-a"
const markerNameB = "example-marker-b"
// いくつかのネストしたタイムアウトを実行し、それぞれに対して PerformanceMark を作成します。
performance.mark(markerNameA);
const c = performance.now();
setTimeout(function() {
performance.mark(markerNameB);
setTimeout(function() {
const d = performance.now();
// using User Timing API. check devTools Perfomarnce tab
performance.measure("measure a to b", markerNameA, markerNameB);
// print console tab
console.log(`measure c to d ${d - c}`);
performance.clearMarks();
performance.clearMeasures();
}, 1000);
}, 1000);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment