The Fast* series of collections were designed to allow access that doesn't require any synchronization around get() calls in the 99.9% use case, while still respecting the fact that the underlying collections are really not thread safe. If you can show me that synchronization on "recent JVM implementations" is so good that it has zero performance impact on that 99.9% use case, I would agree with you that the Fast* classes are no longer needed. However, I remain a skeptic in that regard.
I just ran a quick test comparing the time to access synchronized and unsynchronized methods 1 billon time, here are the results:
1.4.2 1.3.1 (1) 1.3.1 (2) sync 28356ms 15734ms 16549ms unsync 2372ms 2363ms 1688ms
(1) source compiled with the JDK 1.4.2 (2) source compiled with the JDK 1.3.1
I used the Sun VMs on a P4 2.6GHz
Surprisingly in this micro benchmark the 1.3 VM is faster than the 1.4 VM but the ratio is almost the same, the time to access a synchronized method is 10 times slower than an unsynchronized method.
Emmanuel Bourg
public class SyncTest {
public static final long COUNT = 1000000000; public static void main(String[] argv) { long t0, t1; // synchronized method t0 = System.currentTimeMillis(); for (int i = 0; i < COUNT; i++) { synchronizedMethod(); } t1 = System.currentTimeMillis(); System.out.println("synchronized : " + (t1 - t0)); // unsynchronized method t0 = System.currentTimeMillis(); for (int i = 0; i < COUNT; i++) { unsynchronizedMethod(); } t1 = System.currentTimeMillis(); System.out.println("unsynchronized : " + (t1 - t0)); } public static synchronized void synchronizedMethod() { } public static void unsynchronizedMethod() { } }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]