“Eksekusi Waktu JavaScript” Kode Jawaban

Eksekusi Waktu JavaScript

var t0 = performance.now();

doSomething();   // <---- The function you're measuring time for 

var t1 = performance.now();
console.log("Call to doSomething took " + (t1 - t0) + " milliseconds.");
Tough Turtle

Eksekusi Waktu JavaScript

console.time("My Descriptive Title");

doSomething(); // <--- the function that you want to time

console.timeEnd("My Descriptive Title"); // Argument has to match

// My Descriptive Title: 8917.283ms
marnixah

Dapatkan Waktu Eksekusi di JavaScript

var t0 = performance.now()

doSomething()   // <---- The function you're measuring time for 

var t1 = performance.now()
console.log("Call to doSomething took " + (t1 - t0) + " milliseconds.")
SeriousMonk

waktu eksekusi javascript

const { JSDOM } = require("jsdom");
const { window } = new JSDOM();
 
var start = window.performance.now();
 
// task starts
for (var i = 0; i < 100000000;i++);
// task ends
 
var end = window.performance.now();
console.log(`Execution time: ${end - start} ms`);
Lonely Loris

Jawaban yang mirip dengan “Eksekusi Waktu JavaScript”

Pertanyaan yang mirip dengan “Eksekusi Waktu JavaScript”

Lebih banyak jawaban terkait untuk “Eksekusi Waktu JavaScript” di JavaScript

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya