Partners: KDAB Whole Tomato Software CppDepend

23 December 2012

Interesting links in December

This time:
  • Cpp Vector/List/Deque Benchmark
  • Seven productivity myths
  • Modules in cpp, by Doug Gregor
  • Source Making Site
  • Qt Developer Days, Berlin 2012 videos

Cpp Vector/List/Deque Benchmark

This is an interesting blog post from @Blog("Baptiste Wicht") where std::list, std::vector and std::deque are tested. This is a very detailed benchmark so I advise to see this blog entry. Test cases involves:

  • Fill_back - using push_back - vector is of course the fastest solution
  • Linear search - vector is the fastest solution because its elements are in the same chunk of memory
  • Random insert - for small elements vector is better but when you have large data (eg. 128 bytes per element) the list is better
  • Random remove - similar as above
  • Push front - list is of course the best way of doing that
  • Sort - vector good for small elements, but when using 1Kb per element then the list is better
  • Destruction - vector is better because it is very easy to destroy single chunk of memory.
Conclusion: please read the original blog entry, but it general deque seems to be a great data structure! It behaves a bit better that the vector for most kinds of tests. Use list for large elements where cost of copying is quite big.

Seven productivity myths

The article comes from Lifehacker. Although being productive is quite important these days it it not so easy to become such person easily. There are no golden rules you can use and be sure that they will work. This text covers some myths that are worth listing:
  • Get up early... some people can be more productive that way, but other not. Find your best hours of work instead.
  • Internet is making us stupid... the way we use it makes us stupid, but all depends on managing oneself in the world of big and sometimes not important data.
  • Real work at different place that the office... the same as previously: it depends. Some research shown that we can be even more productive than at the office.
  • Productivity Technique will make you happy... if you spend more time on organizing yourself than actual working... than it means that the technique is not working. I think it is good to try some technique and treat them as an exercise.

Modules in cpp, by Doug Gregor

Under this link you will find an interesting presentation about introducing concept of Modules. It was created by Doug Gregor from Apple. Basically a module is a package that describes library interface and its implementation. It is similar to packages in C# or Java, here is some desired final sample code:
import std.stdio;
int main() 
    printf(“Hello, World!\n”);
Simple and easy! So what are the benefits?

  • no need for include guards and mess with header files.
  • improved compilation time complexity. When there is M header files and N source files we have complexity like O(M x N), when using modules we could get O(M + N)
  • speed up of productivity tools that parses the code (refactoring tools, analysers, etc.)
Of course "module" feature is not in the standard yet, but CLANG test implementation is on the way. Thus we can suspect more of news about this topic.

Source Making Site

I have found this web site when looking for some deisgn pattern. There are sections for "Design patterns", "UML", "Refactoring" and "Antipatterns". Examples are very informative and looks sometimes even funny, so it is easy to read and understand them. The whole site is a great source of design info and hints for every programmer (examples in C++, Java, C# and even Delphi and PHP are included)

Qt Developer Days, Berlin 2012 videos

Huge amount of Videos from QT event. QT is very interesting and popular technology for making multiplatform application. What is important that QT focuses a lot on OpenGL. Among various topics we can find: "OpenGL with QT5", "Modern Shader Based OpenGL Techniques ". 
The particular presentation that caught my attention was "Using C++ 11 to speed up your QT5 programs"

By the way: Merry Christmas! :)

Get my free ebook about C++17!

More than 50 pages about the new Language Standard.

C++17 in detail, by Bartlomiej Filipek

© 2017, Bartlomiej Filipek, Blogger platform
Any opinions expressed herein are in no way representative of those of my employers.
This site contains ads or referral links, which provide me with a commission. Thank you for your understanding.