> -----Ursprüngliche Nachricht----- > Von: Craig McClanahan [mailto:[EMAIL PROTECTED] > Gesendet: Donnerstag, 8. September 2005 01:44 > An: Struts Users Mailing List > Betreff: Re: [IMPORTANT] tomcat 5.0.19+ is broken / not > useable with struts / your voice needed
> > but that would mean total dependence on j2se 1.5 and that would be a > > problem for supporting j2se 1.4, though a backport is being > worked on > > here > > > > http://www.mathcs.emory.edu/dcl/util/backport-util-concurrent/ > > > Makes sense to consider this for Tomcat 5.0 (although it may > well be that the performance hit is low enough to make this > extra work unnecessary). > I made some measures and calculations :-) Not using synchronized gets you 63 milliseconds performance gain upon 3.000.000 executions in singlethreaded environment on a p IV 2ghz. Even it's about 4% performance gain (measures differ from run to run since windows is not that exact, i will repeat it on linux tomorrow), gaining 63 millis on 3.000.000 requests isn't even worth thinking about it. Hold your breath and imagine: 0,000021 milliseconds per call. Let's assume you have 1000 (!) parallel requests, it's still 0,021 milliseconds performance gain. I think it's ridiculous :-) Regards Leon P.S. here's my program: public static void main(String a[]){ test(); test(); } private static void test(){ int limit = 1000000; long start1,start2,end1,end2; start1 = System.currentTimeMillis(); executeSynched(limit); end1 = System.currentTimeMillis(); start2 = System.currentTimeMillis(); executeNotSynched(limit); end2 = System.currentTimeMillis(); System.out.println("Executed not synched in "+(end2-start2)); System.out.println("Executed synched in "+(end1-start1)); } private static void executeSynched(int limit){ HashMap h = new HashMap(); for (int i=0; i<limit; i++){ synchronized(h){ h.put("test", ""+i); } synchronized(h){ h.get("test"); } synchronized(h){ h.remove("test"); } } } private static void executeNotSynched(int limit){ HashMap h = new HashMap(); for (int i=0; i<limit; i++){ h.put("test", ""+i); h.get("test"); h.remove("test"); } } And the output: Executed not synched in 1360 Executed synched in 1437 Executed not synched in 1359 Executed synched in 1422 (Execute it twice to be free of VM start or hotswap side effects) --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]