1 Billion nested loop iterations
Javascript
let array = new Array(10000);
for (let i = 0; i < 10000; i++) {
for (let j = 0; j < 100000; j++) {
array[i] = array[i] + j;
}
}
Python
array = [0] * 10000
for i in range(10000):
for j in range(100000):
array[i] = array[i] + j
Go
package main
func main() {
var array [10000]int
for i := 0; i < 10000; i++ {
for j := 0; j < 100000; j++ {
array[i] = array[i] + j
}
}
}
C
int main() {
long array[10000];
for (int i = 0; i < 10000; i++) {
for (int j = 0; j < 100000; j++) {
array[i] = array[i] + j + i;
}
}
}