Recent CodeSOD

Code Snippet Of the Day (CodeSOD) features interesting and usually incorrect code snippets taken from actual production code in a commercial and/or open source software projects.

04 Feb 2016

Log of String

by Jane Bailey in CodeSOD on 2016-02-04

Zrywka drewna 776

The English language contains words with multiple and often contradictory meanings. A dress, for example, is only one of many items you could put on while dressing yourself. Meanwhile, if you want to wear pants instead, you should avoid pantsing yourself, as that would be counter-productive.

81 Comments - Last Comment @ 2016-02-08
02 Feb 2016

High Performance Memory Allocation

by Remy Porter in CodeSOD on 2016-02-02

Jamie has a co-worker who subscribes to the “malloc is slow” school of thought. Now, for most programs, it’s fine, but Jamie works on a high-performance computing system operating in a massively parallel configuration, so there are portions of their application where that philosophy is completely valid.

In this case, however, the code Jamie’s co-worker wrote is in their message handling layer. There’s really no reason to pool buffers there, as the performance gain is practically non-existent based on the frequency of buffer allocation. That doesn’t change Jamie’s co-worker’s opinion though- malloc is slow.

66 Comments - Last Comment @ 09:24