slightly more efficient latency computation