function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
❤Code❤Code 

will System.debug create performace degradation in production if kept

Hi All,

Could you please let me know will there be any performance degradation in production if system.debug are kept.What is the best pratice acording to salesforce for system.debug in production area. 

Should we remove them or not???

Regards
cmoylecmoyle
From this thread here: https://developer.salesforce.com/forums/ForumsMain?id=906F0000000928OIAQ

Code executed, including System.Debug and System.assert (and their variants) have the following effects:

1) They increase debug log sizes.

2) They increase script execution time (but insignificantly).

3) They count against governor limits.

 The salesforce.com best practices state that you should always remove or comment debug statements for production code (part of the security review docs).

 
❤Code❤Code
Hi cmoyle,

Thank u for the help. The point mentioned is it still followed as salesforce best practice. Is there any mechanism we can implement so that debug log present in production will not execute.

Regards