[antlr-interest] Parsing tab delimited datamatrix
Martin Probst
mail at martin-probst.com
Mon May 15 23:24:30 PDT 2006
Hi,
> I'd recommend not to use Vector for various reasons. First of all,
> it is
> synchronized, making it slower. ArrayList should be used in a non-
> threaded
> environment. However both implementations are not optimised for
> incremental
> growth. LinkedList should be more efficient for a growing list.
> It's also the
> best implementation for lineair list traversal.
In theory - yes. But in practice, test results are either indifferent
or better for ArrayList - don't ask me why. Probably allocating a lot
of the linked list container objects is more expensive (also for GC)
than a single array. However you will almost certainly not notice any
difference between them if you're not iterating over more than a
million elements in a tight loop - and compared to the parsing
overhead (character comparison etc) it's almost certainly insignificant.
Plus, all of this is of course premature optimization :-)
Martin
More information about the antlr-interest
mailing list