Skip to the content.

2025-04-30

When building network applications, choosing the right protocol can significantly impact performance. Two of the most common transport protocols, TCP and UDP, offer different trade-offs in reliability, speed, and overhead.

In this post, I compared TCP and UDP round-trip times on a local machine.

What are TCP and UDP?

But how much faster is UDP in practice?

Benchmark Setup

Each message’s round-trip time (RTT) was measured using Go’s time package. Both protocols were implemented using native Go net packages.

Result Summary

Code TCP:

Average round-trip time: 11.275957ms
Dropped messages: 0
Errors: 0

UDP:

Average round-trip time: 11.22507mss
Dropped messages: 0
Errors: 0

Interpretation

In this test with a simulated 10ms network delay, the results show TCP and UDP performing nearly identically in average round-trip time. This may seem surprising given UDP’s lightweight reputation, but the closeness of results can be attributed to several factors:

The result reinforces the idea that real-world conditions are key to revealing true protocol behaviour differences.

Key Takeaways

<Home>