“JavaScript -Zeitausführung” Code-Antworten

JavaScript -Zeitausführung

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

JavaScript -Zeitausführung

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

Holen Sie sich die Ausführungszeit in 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

JavaScript -Ausführungszeit

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

Ähnliche Antworten wie “JavaScript -Zeitausführung”

Fragen ähnlich wie “JavaScript -Zeitausführung”

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen