Jump to content
Excelsior Forums
Sign in to follow this  
roedy

Signum benchmark

Recommended Posts

the latest benchmark harness is posted at http://mindprod.com/jgloss/benchmark.html

*? ? ? ? ? Compare eight different ways of doing a signum.

*? ? ? ? ? Results of benchmarks to find the fastest Long.signum implementation.

*? ? ? ? ?

*? ? ? ? ? stephan fails at -9223372036854775808 giving 0

*? ? ? ? ? sgn fails at 0 giving 1

*? ? ? ? ?

*? ? ? ? ? Candidates at the top with the lowest elapsed time in nanoseconds are fastest.

*? ? ? ? ?

*? ? ? ? ? Under Eclipse 3.1

*? ? ?nanoseconds : candidate

*? ? ?45768960301 : wibble2

*? ? ?49644018723 : wibble

*? ? ?53844393072 : Standard 2 ifs

*? ? ?57757400172 : signOf

*? ? ?62539824754 : sgn

*? ? ?70119185818 : Sun Long.signum

*? ? ?93615190478 : stephan

*? ? ? ? ?

*? ? ? ? ? under Java.exe -client 1.5

*? ? nanoseconds : candidate

*? ? 45046931943 : wibble2

*? ? 52720203825 : Standard 2 ifs

*? ? 53114062821 : signOf

*? ? 54456221112 : wibble

*? ? 65598471873 : sgn

*? ? 67578554258 : Sun Long.signum

*? ? 89407076039 : stephan

*? ? ? ? ?

*? ? ? ? ? under Java.exe -server 1.6

*? ?nanoseconds : candidate

*? ?30604675175 : signOf

*? ?30795535466 : wibble2

*? ?30916536599 : wibble

*? ?37537113795 : sgn

*? ?38492840011 : Standard 2 ifs

*? ?40344760018 : Sun Long.signum

*? ?44422669361 : stephan

*? ? ? ? ?

*? ? ? ? ? under Jet 4.0

*? nanoseconds : candidate

*? 14847425301 : signOf

*? 36774335007 : wibble2

*? 39282795997 : wibble

*? 48173823210 : Standard 2 ifs

*? 73310262058 : sgn

*? 74333541274 : Sun Long.signum

*? 79269158511 : stephan

signOf with Jet is the fastest combination to compute int Long.signum( long diff )

On the other hand, Jet is slower than JDK 1.6 server for all of the non-optimal implementations.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×