How to make 4 pin OLED display run faster

ocsav:
. . .

Use this instead, does the same but it makes more sense.

  pinMode(PHOTOGATE_1_PIN, INPUT_PULLUP);

pinMode(PHOTOGATE_2_PIN, INPUT_PULLUP)

This would depend on the characteristics of the specific optical sensor the OP is using. There is a large variety. Some are open collector types and require a pullup resistor. Other have push/pull output or come with a built-in pullup. The project the OP followed specified an OPL55C. I can't find a data sheet for this specific one, but here is one for related products http://www.farnell.com/datasheets/2331797.pdf