This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: IdentityHashMap & natStackTrace


Bryce McKinlay writes:
 > Ranjit Mathew wrote:
 > 
 > >As Chris points, due to operator precedence weirdness this
 > >becomes a left shift by 3 or multiplication by 23, in line
 > >with what you observed.
 > >
 > >This was introduced almost two years ago in a merge from
 > >Classpath:
 > >
 > >http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/java/util/IdentityHashMap.java.diff?r1=1.8&r2=1.9&only_with_tag=MAIN
 > >
 > >Relevant change:
 > >
 > >  // This isn't necessarily prime, but it is an odd number of key/value
 > >  // slots, which has a higher probability of fewer collisions.
 > >- table = new Object[old.length * 2 + 2];
 > >+ table = new Object[old.length << 1 + 2];
 > >  
 > >
 > 
 > I'd like to make a plea to Classpath developers not to make this kind of 
 > change in the future. Not only does the new code introduce a bug, it is 
 > also more difficult to read, and it won't make any performance 
 > difference on any modern compiler.

Not only that, it won't make any difference on an old interpreter!

Andrew.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]