Re: Which is best Vector or ArrayList? BruceEckel.com has some performance numbers I believe regarding synchronization. I think I read that synchronized calls can take up to 4 times as long.
Don't forget also the synchronization affects Enumeration vs Iterator and other helper classes to the Vector.
While ArrayList can be faster, it is probably not enough in most applications. We ran some performance figures once and we needed hundreds of thousands of entries before the difference became appreciable. I always use ArrayList but it's just preference the synchronization isn't always good. ArrayList also had many other new methods that are from the Map family which are nice to have.
But if you like Vectors use them. You probably heard the first rule of performance tuning is "don't do it"; i.e. don't spend time trying to make something faster until you know where your bottlenecks are. Esp. don't rewrite a bunch of old code to use Vectors it will not be worth it. |