Code review request for 6908131 Pure Java implementations of StrictMath.floor(double) &StrictMath.ceil(double) (original) (raw)

Jeff Hain jeffhain at rocketmail.com
Thu Jan 21 20:58:16 UTC 2010


  Dmitry,

From your bench, I see FloorCeil methods get in trouble with 64 bits architecture, but I never ran anything on 64 bits yet.

I ran your bench on my laptop:

I added two patterns:

I also added test of the pure Java StrictMath class (which is the one you ran as "StrictMath" in your bench?) posted on this subject: "StrictMath_JD".

Here is what I got:  


  pattern 1: empty                took       4,42 nsec  Math.ceil            took      63,77 nsec  Math.floor           took      67,55 nsec  StrictMath.ceil      took      64,20 nsec  StrictMath.floor     took      68,76 nsec  StrictMath_JD.ceil   took      52,58 nsec  StrictMath_JD.floor  took      53,57 nsec  FloorCeil.ceil       took      24,31 nsec  FloorCeil.floor      took      18,37 nsec    pattern 2: empty                took       4,50 nsec Math.ceil            took     110,95 nsec Math.floor           took     110,42 nsec StrictMath.ceil      took     111,38 nsec StrictMath.floor     took     110,97 nsec StrictMath_JD.ceil   took      48,95 nsec StrictMath_JD.floor  took      49,38 nsec FloorCeil.ceil       took      23,29 nsec FloorCeil.floor      took      20,81 nsec   pattern 3: empty                took       4,39 nsec Math.ceil            took     111,72 nsec Math.floor           took     114,48 nsec StrictMath.ceil      took     113,68 nsec StrictMath.floor     took     114,32 nsec StrictMath_JD.ceil   took      60,23 nsec StrictMath_JD..floor  took      60,13 nsec FloorCeil.ceil       took      27,11 nsec FloorCeil.floor      took      23,77 nsec   pattern 4: empty                took       4,38 nsec Math.ceil            took     113,49 nsec Math.floor           took     113,34 nsec StrictMath.ceil      took     110,35 nsec StrictMath.floor     took     112,95 nsec StrictMath_JD.ceil   took      43,69 nsec StrictMath_JD.floor  took      44,28 nsec FloorCeil.ceil       took      22,09 nsec FloorCeil.floor      took      18,71 nsec  


  pattern 1: empty                took       2,40 nsec  Math.ceil            took      64,61 nsec  Math.floor           took      65,14 nsec  StrictMath.ceil      took      63,93 nsec  StrictMath.floor     took      65,99 nsec  StrictMath_JD.ceil   took      37,52 nsec  StrictMath_JD.floor  took      39,77 nsec  FloorCeil.ceil       took      21,36 nsec  FloorCeil.floor      took      13,96 nsec    pattern 2: empty                took       2,23 nsec Math.ceil            took     112,42 nsec Math.floor           took     110,88 nsec StrictMath.ceil      took     112,05 nsec StrictMath.floor     took     113,54 nsec StrictMath_JD.ceil   took      33,98 nsec StrictMath_JD.floor  took      33,97 nsec FloorCeil.ceil       took      22,09 nsec FloorCeil.floor      took      16,75 nsec   pattern 3: empty                took       2,19 nsec Math.ceil            took     113,67 nsec Math.floor           took     113,53 nsec StrictMath.ceil      took     114,46 nsec StrictMath.floor     took     115,02 nsec StrictMath_JD.ceil   took      44,19 nsec StrictMath_JD.floor  took      43,57 nsec FloorCeil.ceil       took      25,57 nsec FloorCeil.floor      took      20,95 nsec   pattern 4: empty                took       2,45 nsec Math.ceil            took     108,56 nsec Math.floor           took     112,96 nsec StrictMath.ceil      took     109,43 nsec StrictMath.floor     took     113,14 nsec StrictMath_JD.ceil   took      30,18 nsec StrictMath_JD..floor  took      31,07 nsec FloorCeil.ceil       took      18,11 nsec FloorCeil.floor      took      15,91 nsec  

Jeff

PS : The ceil and floor I posted here are an extract of a FastMath class (I already      see some people in this mailing list invoking the gods against me while having      a heart attack at the hearing of this class name) I did, and put on source      forge (I already told about it in this list few months ago): maybe some of      you might want to take a look at it (it's called "FastMath", but not ALL of      its treatments are wrong...).

-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.openjdk.java.net/pipermail/core-libs-dev/attachments/20100121/9ef6c03c/attachment.html>



More information about the core-libs-dev mailing list