Can you trigger an interrupt with the IR sensor instead of polling it in the loop?
The detection would then be independent of the loop speed.
In the interrupt service routine you would capture the detection time in milli or microseconds.
On say a uno, this would mean using pins 2 or 3.