-
September 4th, 2016, 02:04 PM
#1
Winsock2 is slower than Ubuntu by 10!
My client/server program runs much slower on Win7 than on Ubuntu 16.04.
While investigating it I narrowed down to as simple code as a loop of two winsock2 calls - socket() & closesocket():
int counter = 0;
while (1)
{
sock = socket(AF_INET, SOCK_STREAM, 0);
if (sock < 0) {
printf("socket() failed!\n");
break;
}
closesocket(sock); // close(sock); on Linux
counter++;
if (counter % 100000 == 0)
{
... // statistic calculation using GetSystemTimeAsFileTime() / clock_gettime() on Linux
}
}
Every 100.000 iterations I print the "number of iterations/seconds" statistic.
On Win7 I get ~64.000 iterations/sec, on Ubuntu ~760.000 iterations/sec.
Win7 Professional, 64 bits, i7-860 @ 2.8 GHz.
Ubuntu 16.04, 64 bits, i7-2800 @ 3.4 GHz.
Win32 and x64 builds give pretty same numbers, debug builds and release (optimized for speed) builds have x10 difference between Win7 and Linux.
iPerf (iPerf -N -4 -c 127.0.0.1 / iPerf -s) shows 3.6 GBit/sec on Win7 and 76 GBit/sec on Ubuntu!
What can be a reason for such poor winsock2 performance?
I will be glad to test any suggestion in real time UTC +2:00
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|