Skip to content

Instantly share code, notes, and snippets.

@shaseley
Created October 20, 2023 18:54
Show Gist options
  • Save shaseley/99c4709527a9d99007e4c78148a4e534 to your computer and use it in GitHub Desktop.
Save shaseley/99c4709527a9d99007e4c78148a4e534 to your computer and use it in GitHub Desktop.
<!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