/**
* Performance for a high number of paths.
*/
public void performance() {
long startTime, endTime;
final CurrencyAmount pvExplicit = METHOD_HW.presentValue(CAP_LONG, BUNDLE_HW);
HullWhiteMonteCarloMethod methodMC;
final int nbPath = 1000000;
methodMC = new HullWhiteMonteCarloMethod(new NormalRandomNumberGenerator(0.0, 1.0, new MersenneTwister()), nbPath);
final int nbTest = 10;
final double[] pv = new double[nbTest];
final double[] pvDiff = new double[nbTest];
startTime = System.currentTimeMillis();
for (int looptest = 0; looptest < nbTest; looptest++) {
pv[looptest] = methodMC.presentValue(CAP_LONG, CUR, CURVES_NAME[0], BUNDLE_HW).getAmount();
pvDiff[looptest] = pv[looptest] - pvExplicit.getAmount();
}
endTime = System.currentTimeMillis();
System.out.println(nbTest + " pv cap/floor Hull-White MC method (" + nbPath + " paths): " + (endTime - startTime) + " ms");
// Performance note: price: 12-Jun-12: On Mac Pro 3.2 GHz Quad-Core Intel Xeon: 2400 ms for 10 cap with 1,000,000 paths.
}