Skip to content

ivanhuay/micron-for-vs-for-of

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Micron Benchmark For vs For of

This is a benchmark to analize if there is performance difference between for and for...of loop.

Motivation

In this benchmark we measure the performance variation a huge array (length 10000000) and measuring the time to loop over this array 10-100 times:

for (let i = 0; i < elm.length; i++) {
  if(elm[i]===2){
    return true;
  }
}

vs

for (let current of elm) {
  if(current===2){
    return true;
  }
}

Results

As expected there is no significant difference between both loop functions.

view results HERE Alt image

run the test

git clone https://github.com/ivanhuay/micron-for-vs-for-of.git

cd micron-process-env

npm i

npm run test

after running that the results should be on the docs folder.

google-chrome docs/index.html

open docs/index.html

About

Micron runner benchmark between for and for-of

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published