2020-05-31 17:44:49 +02:00
|
|
|
const MAX = 1_000_000;
|
|
|
|
|
2021-04-04 17:22:45 +02:00
|
|
|
print(`Iterating an array with ${MAX} items...`);
|
2020-05-31 17:44:49 +02:00
|
|
|
|
|
|
|
print("Ready... Go!");
|
|
|
|
|
|
|
|
let now = timestamp();
|
|
|
|
|
|
|
|
let list = [];
|
|
|
|
|
|
|
|
for i in range(0, MAX) {
|
|
|
|
list.push(i);
|
|
|
|
}
|
|
|
|
|
2021-06-07 08:52:45 +02:00
|
|
|
print(`Time = ${now.elapsed} seconds...`);
|
|
|
|
|
2020-05-31 17:44:49 +02:00
|
|
|
let sum = 0;
|
|
|
|
|
|
|
|
for i in list {
|
|
|
|
sum += i;
|
|
|
|
}
|
|
|
|
|
2021-04-04 17:22:45 +02:00
|
|
|
print(`Sum = ${sum}`);
|
2021-06-07 08:52:45 +02:00
|
|
|
print(`Finished. Total run time = ${now.elapsed} seconds.`);
|