Ping sensor on ATtiny85 gets slow at times?

I am building a simple parking assistant with a ping sensor and a RGB LED as the indicator and everything works great when running on an arduino uno. When I try the adapted code on the ATtiny85 with a breadboard powersupply, there is a severe lag in the speed of the pings. It slows from a ping every 10 milliseconds or so to about one ping each second and each ping causes the LED to flicker. Also, the tone of the ping changes from a barely audible click to more of a buzz. Im just to new to circuits to no whats going on. Another bit that seems strange is that in certain parts of the code, it pings at the right speed and the LED seems to behave as expected (it still could be flickering, just too fast to notice). It seems to be slow when inside a nested if statement, check code below for when exactly it slows down. Forgive my code as it may be somewhat sloppy, I only took one semester of java.

int gLED = 3;
int rLED = 4;
int trigger = 0;
int echo = 1;
int buttonPin = 2;

int duration = 0;
int distance = 0;
int set = 0;
int upper = 0;
int lower = 0;
int range = 4;    //range is +/- so it is double the value
int count = 0;
boolean lastButton = LOW;
boolean currentButton = LOW;
boolean ledOn = false;
int previous = 0;
int current = 0;

void setup()
{
 
 pinMode(gLED, OUTPUT);
 pinMode(rLED, OUTPUT);
 pinMode(trigger, OUTPUT);
 pinMode(echo, INPUT);
 pinMode(buttonPin, INPUT);
}
void loop()
{
  digitalWrite(trigger, LOW);        //reading distance in inches
  delayMicroseconds(2);
  digitalWrite(trigger, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigger, LOW);
  duration = pulseIn(echo, HIGH);
  if(duration == 0) duration = 29600;  //if no distance is returned, set at maximum distance
  distance = (duration/2)/74;        //convert to inches
  current = distance;
  
  delay(10);
  
  currentButton = debounce(lastButton);
  if (lastButton == LOW && currentButton == HIGH)  //when button pushed, set distance for parking
  { 
    set = distance;
    digitalWrite(gLED, HIGH);  //flicker led to indicate set
    delay(50);
    digitalWrite(gLED,LOW);
    delay(50);
    digitalWrite(gLED, HIGH);  
    delay(50);
    digitalWrite(gLED,LOW);
    delay(50);
    digitalWrite(gLED, HIGH);  
    delay(50);
    digitalWrite(gLED,LOW);
    delay(50);
    digitalWrite(gLED, HIGH);  
    delay(50);
    digitalWrite(gLED,LOW);
    delay(50);
  }
  
  lastButton = currentButton;  //reset button
  
  upper = set + range;  //  +/- inch tolerance range  
  lower = set - range;
  
  if(distance <= upper && distance >= lower)
  {
    if(previous == current) count++;
    
    if(count < 200)  //make 100 after debug
    {
    digitalWrite(gLED, HIGH);  //turn on red LED "stop"    this part is slow!
    digitalWrite(rLED, LOW);  
    }
    else
    {
    digitalWrite(gLED, HIGH);    //turn off both LED, car is parked, there is no need to indicate
    digitalWrite(rLED, HIGH);
    if(current != previous) count = 0;  //if car moves, count is reset and exits power save
    }
    
  }
  else if(distance > upper)
  {
    if(distance >= set+80);
    {
      digitalWrite(rLED, HIGH);  //pull up resistor inverts command, oops
      digitalWrite(gLED, HIGH);
    }
    if(distance < set+80 && distance > set+40)    //if distance is less than set + 80 inches
    {
    digitalWrite(rLED, HIGH);    //green LED on "keep coming"   this part is slow!
    digitalWrite(gLED, LOW);  
    }
    if(distance <= set+40 && distance > upper)
    {
      digitalWrite(rLED, LOW);  //yellow "slow down"    this part is slow!
      digitalWrite(gLED, LOW);
    }  
  }
  else if(distance < lower)
  {
    digitalWrite(gLED, HIGH);    // flicker red LED "too close, back up"       this part works fine!
    digitalWrite(rLED, LOW);
    delay(100);
    digitalWrite(rLED, HIGH);
    delay(100);
  } 
  
  previous = current;
}

boolean debounce(boolean last)
{
  boolean current = digitalRead(buttonPin);
  if (last != current)
  {
    delay(5);
    current = digitalRead(buttonPin);
  } 
  return current;
}

All those delays, you miss the bus by just a bit then you have to wait for the next one.

Also using a light for the user output, the driver ends up with visual attention on the light instead of looking behind. If you use sound instead it will be safer.

Yes, I wasn't thinking of backing in yet thats probably the most important application. Thanks for the ideas. The areas in code where there are delays are actually working fine, the first delay is the speed of the loop, the set of 8 delays is only when the button is pushed(works), and two delays to flicker the LED when you get too close(works - pings fast). What exactly do you mean by miss the bus?

ok, extending the loop delay from 10 to 100 fixed the lagging, but now I have a new problem, when there is no distance read by the sensor, it creates a 1 second delay. I found a NewPing library with claims to fix this problem but alas, it throws about a million errors at compile. any other ideas to fix this?

There is a much better way to cause things to happen in time than using delays.
Reason is that during delay() nothing else is done. No checks, no actions, no response.

Here is a very clear and simple explanation of the problem and solution that includes code:

When you learn that your whole understanding can change. You won't be locked into set steps that must be one after the other but be able to make each part work on its own.

Excerpt:

Let's look at an analogy. Say you want to cook breakfast. You need to cook:

Coffee - takes 1 minute
Bacon - takes 2 minutes
Eggs - takes 3 minutes

Now a seasoned cook would NOT do this:

Put coffee on. Stare at watch until 1 minute has elapsed. Pour coffee.
Cook bacon. Stare at watch until 2 minutes have elapsed. Serve bacon.
Fry eggs. Stare at watch until 3 minutes have elapsed. Serve eggs.

The flaw in this is that whichever way you do it, something is going to be cooked too early (and get cold).

In computer terminology this is blocking. That is, you don't do anything else until the one task at hand is over.

What you are likely to do is this:

Start frying eggs. Look at watch and note the time.
Glance at watch from time to time. When one minute is up then ...
Start cooking bacon. Look at watch and note the time.
Glance at watch from time to time. When another minute is up then ...
Put coffee on. Look at watch and note the time.
When 3 minutes are up, everything is cooked. Serve it all up.