Check if debug is enabled for performance