const N = 200000; c = 0; for (let rep = 0; rep < 10; rep++) for (n of [30, 100, 300, 1000, 3000]) { console.log(n); a = []; for (let i = -n/2; i < n/2; i++) { a[i] = []; for (let j = -n/2; j < n/2; j++) { a[i][j] = 'B' } } console.time('mew'); for (let it = 0; it < N; it++) { const x = N%(n-10)-n/2+2; const y = N%(n-20)-n/2+5; c = a[x][y]; } console.timeEnd('mew'); } console.log(c);