jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Felix Meschberger <fmesc...@gmail.com>
Subject Re: Generics generator class
Date Wed, 06 May 2009 11:25:50 GMT
Hi,

Thomas Müller schrieb:
> Hi,
> 
>> I do care about performance, so yes, I'd like so see numbers.
> 
> My test case is:
> 
> public static void main(String[] args) {
>     for (int i = 0; i < 3; i++) {
>         long start = System.currentTimeMillis();
>         ArrayList list = new ArrayList();
>         for (int j = 0; j < 1000000000; j++) {
>             list.size();
>         }
>         System.out.println(System.currentTimeMillis() - start);
>     }
> }
> 
> With JDK 1.5 (Mac OS X): ArrayList declaration: 3028 List declaration: 8037

I stand corrected, but is this worth it ??

> 
> But I agree it's almost never really an issue. Most performance
> problems are not related to this.

Oh yeah !

Regards
Felix

> 
>> Bloch advises to use interfaces in Effective Java, 2nd edition, Item 52.
> 
> In Effective Java, first edition, it's issue 34, page 156: "Refer to
> objects by their interfaces - If appropriate interfaces exist,
> parameters, returns values, variables, and fields should all be
> declared using interface types". ... "could be changed ... and all of
> the surrounding code would continue to work"
> 
> I do agree to this, except for variables and private fields that don't
> affect the surrounding code.
> 
> Regards,
> Thomas
> 


Mime
View raw message