Can someone explain to me the advantage of JIT compilers?  It's obviously
faster .. I've been doing some recusion testing and the Sun JDK 1.3 for
Linux
runs on average 3 times faster than the jdk 1.2.2 rc4 from blackdown.org.

Here's my very simple nchoosek recursive method:

/** nchoosek recursive function **/

public class nchoosek {
        public static void main(String[] args) {

            if(args.length<2) return;
            int n=Integer.parseInt(args[0]);
                int k=Integer.parseInt(args[1]);
                nchoosek func = new nchoosek();
                long start = System.currentTimeMillis();
                System.out.println(func.choose(n,k));
                long end = System.currentTimeMillis();
                System.out.println("took " + (end-start) +
                                                        "milliseconds (~" +
                                                        (float)(end-start)/1000 +
                                                        " seconds) !!");
        }

        public int choose(int n, int k) {
                if(k==0) return 1;
                if(n==1) return n;
                if(n==k) return 1;
                return choose(n-1,k) + choose(n-1,k-1);
        }
}

Machine: Pentium Pro 200Mhz w/ 128Mb of RAM:
-On jdk 1.2.2 rc4 by blackdown ~10 seconds
-On jdk 1.2.2 by Sun for Linux ~28 seconds
-On jdk 1.3 by Sun for Linux   ~3 seconds!


----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to