Countries of Top 200 CodeProject Members

Note: the data is taken at 2019-01-26. In CodeProject, a place where like-minded programmers share knowledge: There are 2 main ways to gain reputation points, either by answering questions in the Quick Answers section or writing quality articles. A third way to gain points is to post a good comment/message in forum or article threadContinue reading “Countries of Top 200 CodeProject Members”

C++11 std::div() Benchmark

Download source at Github Update: rand() overhead in benchmark has been removed by filling the array with random values beforehand. C++11 standard introduces std::div() and its siblings on the premise of some compiler can take advantage of the available machine code that compute quotient and remainder of division together. The C++ reference noted, and (updated)Continue reading “C++11 std::div() Benchmark”

Not Every Memory Allocation Failure is OOM

Introduction As with many C++ programmers with C background, bring their C habits to C++ programming as shown in the below code where a massive array is allocated and pointer is then checked for failed allocation in presence of null address. It works this way for C malloc. Unfortunately, C++ new does not work likeContinue reading “Not Every Memory Allocation Failure is OOM”

H264 Video Encoder for OpenGL

Download the source from GitHub Though this long article has more lines than the encoder library itself, this is a very simple and easy to read and understand article. If you have read my other articles before, you will be comfortable to know I do not write complicated stuff. Table of Contents Introduction Running theContinue reading “H264 Video Encoder for OpenGL”

Floating Point and Integer Arithmetic Benchmark

Introduction This is not much of a tip, just a posting of benchmark result to compare integer and floating point arithmetic timing. All the integer and floating point types used in Benchmark are 64bit. Timing is based on looping 100 million times. Clarification: SmallInt and SmallDouble refers to small values (10-10000) stored in int64_t andContinue reading “Floating Point and Integer Arithmetic Benchmark”

C++: Simple Permutation and Combination Parallelism

Primary Motivation Single Threaded Permutation Multi-Threaded Permutation Single Threaded Combination Multi-Threaded Combination Primary Motivation My Github repository, Boost Concurrent Permutations and Combinations on CPU, has been up since January 2017. However, download is close to none while my older single threaded next_combination has plenty of downloads. So I figured it must be the code usageContinue reading “C++: Simple Permutation and Combination Parallelism”

Improved Next Combination with State

To speed up next_combination, we can store the state of generated combination so that it does not have to find which current combination elements correspond to the bigger collection. One way to do it is to store this state inside a class but this violates the design of STL algorithms. Another way to do it,Continue reading “Improved Next Combination with State”