I've been preparing some analysis of synchronization overhead in 
benchmarks for the JavaOne talk I'm doing with Doug.
Here are some interesting results on the spec db benchmark, which is 
single threaded.
The following gives execution time (in seconds) for different 
versions of the the Spec db benchmark.
Original - using the original benchmark
ArrayList - convert the benchmark to use ArrayList rather than Vector
New Algorithm - replace the hand coded shell sort with a call to the
        built in merge sort
Both - both of the above two transformations.
Sync - Using the standard rt.jar
Unsync - Using a version of rt.jar in which synchronization has been removed
         from Hashtable, Vector, Stack, BufferedInputStream and
         BufferedOutputStream.
Original	Sync	44.6
Original	NoSync	36.3
ArrayList	NoSync	34.1
ArrayList	Sync	34.1
New Alg		Sync	19.5
Both		Sync	15.5
Both		NoSync	14.5
New Alg		NoSync	14.3
The lesson from this: yes, there is some synchronization overhead, but it is
        dwarfed by the stupidity overhead
By the way, the version that uses merge sort reports "Incorrect" 
results. The reason for this is that the merge sort is stable, while 
the shell sort is not. In truth, you'd prefer a stable sort. But it 
does give you different results.
        Bill
-------------------------------
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel
This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:00:25 EDT