0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

console.timeで処理時間を表示する

0
Posted at

console.timeを使用すると細かく処理にかかっている時間を見ることができる

console.time("Loop");
for(i = 0; i >= 10000; i++){
    // 処理
}
console.timeEnd("Loop");

// 結果
// Loop: 7.615ms

下記のように時間をとるとms単位で時間をとることができなかった

let startTime = Date.now();
for(i = 0; i >= 10000; i++){
    // 処理
}
console.log(Date.now() - startTime);

// 結果
// 0
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?