Last active
August 29, 2017 21:48
-
-
Save nolanlawson/1dd8f322eace0237ec672b57f2122459 to your computer and use it in GitHub Desktop.
Thrash party
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<head> | |
<title>Thrash party</title> | |
<style> | |
div { | |
width: 0px; | |
height: 0px; | |
background: green; | |
color: green; | |
} | |
</style> | |
</head> | |
<body> | |
<h1>Thrash party</h1> | |
<button type=button>Run</button> | |
<div class="target"></div> | |
<pre></pre> | |
<script> | |
(function () { | |
document.querySelector('button').addEventListener('click', () => { | |
var start = performance.now() | |
var div = document.querySelector('.target') | |
for(var i = 0; i < 5000; i++) { | |
div.style.height = 0 | |
div.getBoundingClientRect() | |
} | |
var end = performance.now(); | |
document.querySelector('pre').innerHTML += (end - start) + '\n' | |
}) | |
})() | |
</script> | |
</body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment