Created
October 20, 2023 18:54
-
-
Save shaseley/99c4709527a9d99007e4c78148a4e534 to your computer and use it in GitHub Desktop.
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> | |
<meta charset="utf-8"> | |
<title>Test React Scheduler</title> | |
<script src="rs.js"></script> | |
<button onclick="runTest()">Run test</button> | |
<script> | |
const TEST_DURATION = 300000; | |
function runTest() { | |
const spin = (howLong) => { | |
const start = performance.now(); | |
while (performance.now() - start < howLong); | |
} | |
let testStart = performance.now(); | |
console.log('Test starting: ' + testStart); | |
const iter = () => { | |
spin(5); | |
const now = performance.now(); | |
if (now - testStart < TEST_DURATION) { | |
return iter; | |
} | |
console.log('Test finished in ' + (now - testStart) + ' ms'); | |
}; | |
window.schedule(3, () => iter()); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment