Skip to content

Instantly share code, notes, and snippets.

@SirmaXX
Last active February 20, 2022 00:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SirmaXX/36124be2a5a78f806804c384fe44e026 to your computer and use it in GitHub Desktop.
Save SirmaXX/36124be2a5a78f806804c384fe44e026 to your computer and use it in GitHub Desktop.
bahattin benchmark
<!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>
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