My blog
My LinkedIn Profile

BOOKS i'm reading

Napoleon Hill Keys to Success: The 17 Principles of Personal Achievement, Napoleon Hill, ISBN: 978-0452272811
The 4-Hour Workweek: Escape 9-5, Live Anywhere, and Join the New Rich (Expanded and Updated), Timothy Ferriss, ISBN: 978-0307465351
The Fountainhead, Ayn Rand, ISBN: 0452273331



Permalink 11:33:38 pm, by lano1106, 224 words, 155 views   English (CA)
Categories: TCP/IP

Problem reach maximum transfer speed with 10Gbits Ethernet

I saw a very entertaining youtube video where the host has tested 10 Gbits Ethernet cards on a LAN to perform file transfers. He somehow could not reach the maximum theoritical transfer speed. Here is my explanation why and it is probably that simple:

I do not know what was the protocol underneath for the transfer but if it is TCP, there is something called the bandwidth-delay product that says that in order to keep the network pipe full, you need sufficient TCP send and receive buffers.

Let me show you how to compute that. RTT is basically given by ping. Lets assume worse case scenario with a RTT of 0.2 mSec. 10Gbit/sec is 1250MB/sec or 1,250,000,000 B/sec.

1,250,000,000 B/sec * 0.0002 sec = 250,000B or 250KB. Last time I have checked (I'm a Linux guy) default Windows TCP buffers size were something around 16KB or perhaps 64KB. These are the parameters that you would need to play with to get close to the 10GB/sec rates.

You can change the default value through the registry or on a per connection basis with the socket API.

If we take your maximum transfer rate in your video which was roughly about 360MB/sec and plug it in the bandwidth delay product formula, I get 72KB which is very close to 64KB. Pretty sure that this is your problem!


Permalink 10:44:16 am, by lano1106, 8 words, 200 views   English (CA)
Categories: General

How a TRS-80 can help you dominating interviews


Permalink 12:28:33 pm, by lano1106, 9 words, 170 views   English (CA)
Categories: Recommended books

Double Your Odds oF Getting Your Dream position in 14 DaYs or Less

My first book is now available:
Hacking LinkedIn Formula


Permalink 08:55:53 am, by lano1106, 28 words, 360 views   English (CA)
Categories: Recommended books

Improve 3 elements in your resume or your linkedin profile to double their effectiveness

free ebook where I show how to write a job description in a resume or for a linkedin profile for a MAXIMUM IMPACT.
how to write a job description in a resume or for a linkedin profile for a MAXIMUM IMPACT


Permalink 08:41:03 pm, by lano1106, 236 words, 1508 views   English (CA)
Categories: Linux

malloc + memset vs calloc: which is better?

I always had the intuition that allocating and initializing the memory to 0 in a single step could be faster than doing it yourself even if modern C compilers replace the memset() calls with inline assembly instructions. By browsing the glibc malloc source code for another problem, I had the perfect opportunity to validate my intuition and it turns out that my intuition was correct!

On Linux, the glibc heap manager is using the sbrk() system call to grow the heap. The fresh memory returned by sbrk() is initialized to, guess which value??, 0. glibc heap manager keeps track of memory in its heap that is freshly returned by sbrk() and calloc() can leverage this information to return memory already containing zeros and skipping totally the memset() step!

I did benchmark what I was writing and I did find out that, with glibc 2.18, it is true only for allocation size > ~ 64KB. Smaller than that malloc + memset is faster. I have reported this finding to the glibc mailing list. I still advocate to prefer calloc() as the current result is probably temporary and I expect future version to remove this anomaly.

for those desiring to play with the test, you can get these files:


to build do:

gcc -O3 -c calloc_emul.c

Play with the various define values and

gcc -O3 -c tst-calloc.c
gcc -o tst-calloc tst-calloc.o calloc_emul.o

:: Next Page >>

Olivier Langlois's blog

I want you to find in this blog informations about C++ programming that I had a hard time to find in the first place on the web.

| Next >

November 2015
Sun Mon Tue Wed Thu Fri Sat
 << <   > >>
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30          


Custom Search


XML Feeds

What is RSS?

Who's Online?

  • Guest Users: 2

powered by