"@Stanislav: In my case, A is a function of a a lot of parameters, and takes ~0.1s to calculate (Monte Carlo simulation)." . . . . .