Tagged: C++ Toggle Comment Threads | Keyboard Shortcuts

  • fala13 17:59 on 02/06/2014 Permalink | Reply
    Tags: C++, compilation, gcc,   

    Bad performance after switching to C++11?! 

    Recently tool chain in my company (which is called Nokia now – awesome, right?) was update from GCC 4.2 to GCC 4.7. Everybody in my project was very excited – our software will be faster thanks to the move concept and just from standing next to the new compiler! And developers will be able to write lambdas that no one else will be able to decode!

    When first performance test results came in I was puzzled – improvement was expected and we got 5-10% performance decrease? I had to ask my overly enthusiastic developers to wait with enriching their code with new shenanigans and I’ve put my detective hat on.
    I’ve discovered that the new compiler is not to blame, only adding -std=c++11 makes the difference and shortly after Stackoverflow came with help: http://stackoverflow.com/questions/20977741/stdvector-performance-regression-when-enabling-c11
    Sufficient to say, default settings of GCC don’t trigger proper inlining of container methods of the STL’s C++11 version. When we increased the -finline-limit the performance got back to level without the -std=c++11 flag. But not a bit higher.

    Background: Our project does lot of message handling, uses STL quite heavily and is around 1 milion LOC. We get best results with -O2, yes, even better than with -O3. I have tested various flag combinations and nothing matches regular -O2. But that is for our application and our fast path use pattern. For yours you should always test, test and test for yourself (and investigate!).

  • fala13 06:05 on 03/07/2013 Permalink | Reply
    Tags: C++, contest,   

    The Prize 

    WP_001278 (2)Every year I try to participate in the main polish programming contest Potyczki Algorytmiczne. It takes 1 week during which you are completely detached from your life and family. Since the level is quite high only it is impossible to get to the top 20 which takes part in the finale for people who don’t participate in such events on regular basis. So why waste a week every year?

    It is just like running in marathons. You run (I don’t, but it makes for a nice metaphor) to stay healthy, to show that you can endure the distance, to prove something to yourself. To have an achievement of some kind. And the same goes for programming contests like this. You want your brain to stay sharp, to still be proficient with the things you learned during your studies, to prove to yourself that you can tackle problems ordinary people can not. And you train C++ STL usage heavily which is good for your regular job. Luckily the PA contest gives T-shirts to first 256 contestants (there is about 1000 people participating each year) so you have some souvenir for your struggles.

    This year there were some cool problems, many dealing with primality testing. I made and environment consisting of UT, acceptance tests and gprof (total overkill) to ensure I don’t loose any points easily. You don’t want to loose your weekend for nothing!

    (Phew, it was hard to make this post about something else than bragging about having the 2013 t-shirt finally delivered.)

Compose new post
Next post/Next comment
Previous post/Previous comment
Show/Hide comments
Go to top
Go to login
Show/Hide help
shift + esc