Skip to content

Instantly share code, notes, and snippets.

@patrickhulce
Created July 13, 2017 23:07
Show Gist options
  • Save patrickhulce/69d8bed1807e762218994b121d06fea6 to your computer and use it in GitHub Desktop.
Save patrickhulce/69d8bed1807e762218994b121d06fea6 to your computer and use it in GitHub Desktop.
Infinite TTCI
<html>
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
<body>
Just try and figure out my TTCI (hint: it should be NEVER)<br>
This is a test to ensure we properly handle PerformanceObserver lifecycle, see
<a href="https://crbug.com/742530">https://crbug.com/742530</a>
<script>
/**
* Stalls the main thread for timeInMs
*/
function stall(timeInMs) {
const start = performance.now();
while (performance.now() - start < timeInMs) {
for (let i = 0; i < 1000000; i++) ;
}
}
function keepStalling() {
stall(50);
setTimeout(keepStalling, 4000 + Math.random() * 700);
}
keepStalling();
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment