What are the c++ compiler optimization flags?

  • 2

    Based on my benchmarks I suspect that copy elision is disabled. I wonder if the tests are biased against use of STL containers which really need compiler optimization (eg inlining) to shine.

  • 0

    Not only this, but the leetcode results I see indicate that identical code in C++ and C is slower in C++. That means no STL or anything. It looks clear that the options for C++ are screwed up in some way. It doesn't make sense to me to give any weight to the performance of code that's built without being able to set the optimization and codegen flags.

  • 2

    Yes seems that OJ is running on -O0 which makes
    bad code look fast and good code look slow. That is the most horrible and ignorant decision ever. I would advise anyone interested in optimisation to ignore performance results completely.

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.