Adjoint algorithmic differentiation can be used to implement efficiently the calculation of counterparty credit risk. We demonstrate how this powerful technique can be used to reduce the computational cost by hundreds of times, thus opening the way to real time risk management in Monte Carlo