<script>
    function runFaster() { 
      for (let i = 0; i < ROWS; i++) {
        for (let j = 0; j < COLS; j++) {
          arr[i * ROWS + j] = 0;
        }
      }
    }

    function runSlower() {
      for (let i = 0; i < COLS; i++) {
        for (let j = 0; j < ROWS; j++) {
          arr[j * ROWS + i] = 0;
        }
      }
    }

    const ROWS = 1000;
    const COLS = 1000;

    const arr = new Array(ROWS * COLS).fill(0);

    function testFunctionRuntime(repeats, functionToTest, logText = 'Benchmarking') {
        console.time(logText);
        for (let i = 0; i < repeats; i++) {
            functionToTest();
        }
        console.timeEnd(logText);
    }
 </script>