classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: java.util.Hashtable.size()/isEmpty()


From: Bryce McKinlay
Subject: Re: java.util.Hashtable.size()/isEmpty()
Date: Sat, 16 Feb 2002 10:37:35 +1300
User-agent: Mozilla/5.0 (X11; U; Linux ppc; en-US; rv:0.9.7) Gecko/20011221

Etienne M. Gagnon wrote:

Artur Biesiadowski wrote:

First - removing as much synchronization as possible, while staying compatible is certainly a good thing. Synchronizing is _really_ costly -


Have you heard of "thin locks" and other VM level optimizations that reduces "significantly" the cost of locks? Do not compute the cost of locks based on their implementation in Sun's old JDK, or based on an implementation that does not implement state-of-the-art techniques.


Synchronization techniques have improved, however it will always be slow (relative to other operations) in a multithreaded/multiprocessing environment, because it cannot be done without some form of spinlocking or memory bus synchronization. The only way to truely make it fast for a multiprocessor would be to come up with some magic bus architechture which is as fast as the cpu cores!

Systems like "HotSpot/Jalapeno" are getting to the point where the are able to identify things like "single threaded programs" and thus eliminate all lock operations when possible.


Yes. But remember that many of the applications that are hurt most by synchronization (AWT, Swing) are never single threaded.

regards

Bryce.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]