Bad GPU performance when compiling with -G parameter with nvcc compiler

I am doing some tests and I realized that using the -G parameter when compiling is giving me a bad performance than without it.

I have checked the documentation in Nvidia:

--device-debug (-G)                         
    Generate debug information for device code.

But it is not helping me to know the reason why is giving me such bad performance. Where is it generating this debug information and when? and what could be the cause of this bad performance?

In addition to generating “debug information”, the -G switch disables many (most) device code compiler optimizations. The effect of this can be substantial on device code execution performance. Use -G just for debugging. When you want to build production code, don’t use -G.

Thank you so much txbob for your soon reply, I noticed because when I was doing some computations, it was taking around 20x more time than without it.
Do you know where can I find more information related to this problem?

Best regards!

Well, debug modes were never meant to be performance modes. They were meant to be able to tell you everything the code is doing, distinctly eschewing performance concerns to do so. This means that it’s not a problem, just that when you’re developing code you should have a “debug” version and then when it’s ready to release, you strip it of all those types of things which in your case is just removing the -G flag when compiling.