Folks, there is a tool that is heavily misused, a tool that was meant for a completely different task but is now used by people to measure or compare something: ping. Don’t use it as a latency measurement tool. Ping doesn’t deserve this. Ping is a tool to find out whether a host is reachable via IP (that said, I’ve seen more than one situation where a system was reachable by ping but otherwise absolutely dead).
However, the numbers it reports, with three decimal places, suggest that it really measures network latency precisely. The measurement itself may well be that precise. The truth, however, is that it doesn’t measure network latency; it measures an amalgam of many things, and the network is just one part of it. When you ping, you are measuring the time from sending the ICMP echo request to the moment the ping tool receives the ICMP echo reply. So far, so good. However, this also includes the time it takes when the ping tool has given up the CPU while waiting and has to be scheduled onto a CPU again. And when you compare implementations, it may well be that an ICMP implementation was considered good enough and was never optimized any further, because I don’t think there is a single person on the planet for whom ICMP echo request/reply is a mission-critical, performance-critical part of their workload.
There are better tools to measure latency. On Solaris, for example, there is superping.d, which combines DTrace and ping to get a much more precise picture of the real network latency by closely monitoring the network stack. On the other hand, ICMP is answered in the kernel, so if you really want to measure network latency from application to application, use a tool like iperf that runs as a process in userland (… and run it with scheduling priorities similar to those of your real application).
BTW: Before you ask … even with a 1 GbE interface you can measure a difference between the latency reported by ping and the latency measured by superping.d. Now take the reduced physical latencies of 10 GbE or even InfiniBand networks into consideration and think about what that means for the precision of your measurement.
So please: Use ping as a tool to make a first guess whether the system on the other side is up and running. But don’t use it to measure network latencies in your local network (or, even worse, to assess the quality of a networking implementation). I dare you, I double dare you ;)