Issues with servo-mounted ultrasonic sensor on autonomous car - SOLVED

Another issue I'm running into is being able to read multi-dimensional arrays quickly. To avoid obstacles, I use the servo position and the distance measured by the sensor to populate an array of (angle, distance) ordered pairs. I plan to read from this array when choosing the best path for the vehicle. The contents of the array should also be able to be read quickly so that the car can rapidly respond to its surroundings. The problem I'm having is with getting the array to be read quickly. It takes about a second to read the contents of a 2 column, 37 row array. How should I revise my code such that the array can be read faster?

Notice the pause that corresponds to reading the array when the servo is about to change direction:

The last ditch solution is to take less measurements, which would hopefully speed up the rate of array reading. But, the cost of this is a lower resolution map of the vehicle's surroundings. Alternatively, I could have the sensor read distances over a narrow range of angles. But I would also like to avoid this. What other solutions can you think of?

// setup ultrasonic distance sensor
const int pingPin = 2;
unsigned int duration, distance;

// setup servo under sensor
#include <Servo.h> 
Servo sensingServo;
int pos = 1300;
int sensingServoMin = 800;
int sensingServoMax = 1700;
int sensingServoResolution = 25;
boolean sweepLeft = true;

// setup array for storing directions and distances
// array length = ((sensingServoMax - sensingServoMin) / sensingServoResolution) + 1;
int directionsAndDistances[37][2];
int i;

void writeArray()
{
  // move servo into position
  sensingServo.writeMicroseconds(pos);
  
  // read ultrasonic sensor
  pinMode(pingPin, OUTPUT);
  digitalWrite(pingPin, LOW);
  delayMicroseconds(2);
  digitalWrite(pingPin, HIGH);
  delayMicroseconds(5);
  digitalWrite(pingPin, LOW);
  pinMode(pingPin, INPUT);
  duration = pulseIn(pingPin, HIGH);
  distance = duration / 74 / 2; 
    
  // write position and distance to array
  directionsAndDistances[i][0] = pos;
  directionsAndDistances[i][1] = distance;
  
  i++;
  delay(10);
}

void setup() 
{
  Serial.begin(9600);
  sensingServo.attach(5);  
}

void loop() { 
  i=0;  
  
  if (sweepLeft)
  {
    // sweep left
    for(pos = sensingServoMin; pos <= sensingServoMax; pos += sensingServoResolution)
    {
      writeArray();
    }
    sweepLeft = false;
  }
  
  else
  {
    // sweep right
    for(pos = sensingServoMax; pos >= sensingServoMin; pos -= sensingServoResolution)
    {                                
      writeArray();
    }
    sweepLeft = true;
  }
  
  // print contents of position and distance array
  for(int j = 0; j < 37; j += 1)
  {
    Serial.print("Position:  ");
    Serial.print(directionsAndDistances[j][0]);    
    Serial.print("  Distance:  ");
    Serial.print(directionsAndDistances[j][1]);
    Serial.print("\n");   
  }
}