Test name | Executions per second |
---|---|
Initial call | 881426624.0 Ops/sec |
Multiple calls | 885384704.0 Ops/sec |
const alphabet = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"];
function generateItems(numberOfItems){
const result = [];
for ( var i = 0; i < numberOfItems ; i++ ) {
result.push( alphabet[Math.floor(Math.random() * alphabet.length)]);
}
return result;
}
const list = generateItems(1000000);
function myFunc(){
for(let i = 0; i < list.length -1; i ++){
list[i] = list[i].toLowerCase()
}
}
function myFunc(){
for(let i = 0; i < list.length -1; i ++){
list[i] = list[i].toLowerCase()
}
for(let i = 0; i < list.length -1; i ++){
list[i] = list[i].toLowerCase()
}
for(let i = 0; i < list.length -1; i ++){
list[i] = list[i].toLowerCase()
}
}