https://bz.apache.org/bugzilla/show_bug.cgi?id=62506
duffy duck <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEEDINFO |NEW --- Comment #2 from duffy duck <[email protected]> --- Hi, we have executed the following test: with 10.000.000 iterations the execution time is changed from 800ms to 4s. Random r = new Random(); double result; int loopNumber = 10000000; long startTime = System.currentTimeMillis(); // 800 ms for (int i=0; i<loopNumber; i++) { double d0 = r.nextDouble(); double d1 = r.nextInt(5); double multi = Math.pow(10d, d1); if (d0 < 0) result = -Math.floor(-d0 * multi) / multi; else result = Math.floor(d0 * multi) / multi; } long lapTime = System.currentTimeMillis(); System.out.println("Old calculation for " + loopNumber + " occurrence take " + (lapTime-startTime) +" ms"); // 4s for (int i=0; i<loopNumber; i++) { double d0 = r.nextDouble(); double d1 = r.nextInt(5); result = new BigDecimal(Double.toString(d0)).setScale((int)d1,BigDecimal.ROUND_DOWN).doubleValue(); } long endTime = System.currentTimeMillis(); System.out.println("New calculation for " + loopNumber + " occurrence take " + (endTime-lapTime) +" ms"); -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
