Last active
February 20, 2022 00:42
-
-
Save SirmaXX/36124be2a5a78f806804c384fe44e026 to your computer and use it in GitHub Desktop.
bahattin benchmark
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> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Document</title> | |
<script src="work.js"></script> | |
</head> | |
<body> | |
</body> | |
</html> |
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
let startTime, endTime; | |
function on(n) { | |
var toplam = 0; | |
for (let i = 0; i < n; i++) { | |
toplam += i; | |
} | |
return toplam; | |
} | |
//fonksiyonun çalışmasındaki başlangıç zamanı | |
startTime = performance.now(); | |
//fonksiyonun çağrılması | |
on(1000000); | |
////fonksiyonun çalışmasının bitiş zamanı | |
endTime = performance.now(); | |
//bitiş zamanı-başlangıç zamanı = fonksiyonun çalışma hızı | |
console.debug("Elapsed time:", endTime - startTime); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment