-
-
Save quan17/b6ab4348c45798b0a2ae5af1b9a45a18 to your computer and use it in GitHub Desktop.
A CPU intensive operation. Use to test imitate blocking code, test WebWorkers etc.
This file contains hidden or 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
| function mySlowFunction(baseNumber) { | |
| console.time('mySlowFunction'); | |
| var result = 0; | |
| for (var i = Math.pow(baseNumber, 10); i >= 0; i--) { | |
| result += Math.atan(i) * Math.tan(i); | |
| }; | |
| console.timeEnd('mySlowFunction'); | |
| return result; | |
| } | |
| mySlowFunction(3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment