DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=35037>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=35037





------- Additional Comments From [EMAIL PROTECTED]  2005-05-24 23:44 -------
I don't know what you were measuring but that's not the the case in any 
environment I've seen since 
JDK 1.3, even with the client VM. To see for yourself try this, with and 
without cast() / cast2(). 


        public static void main(String[] args) throws Exception {
                int iters = Integer.parseInt(args[0]); // e.g. 1000
                int runs = Integer.parseInt(args[1]);  // e.g. 3
                int sum = 0;
                Object[] arr = new Object[10000];
                Object obj = "xx";
                if (Boolean.valueOf(args[2]).booleanValue()) obj = new 
Integer(0);
                for (int i=0; i < arr.length; i++) arr[i] = obj;
                
                for (int run=0; run < runs; run++) {
                        System.out.println("\nrun=" + run);
                        long start = System.currentTimeMillis();
                        for (int j=0; j < iters; j++) {
                                for (int i=0; i < arr.length; i++) {
                                        sum += cast2(arr[i]).charAt(0);
//                                      sum += cast(arr[i]).charAt(0);
                                }
                        }
                        long end = System.currentTimeMillis();
                        System.out.println("secs = " + ((end-start) / 1000.0f));
                }
                System.out.println("checksum=" + sum);
        }
        
        private static String cast(Object x) {
                if (x instanceof String) return (String)x;
                return "yy";
        }
        
        private static String cast2(Object x) {
                try {return (String)x; } catch (ClassCastException e) { return 
"yy"; }
        }


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to