[josm-dev] Jumbo Patch
    Gabriel Ebner 
    ge at gabrielebner.at
       
    Tue Dec 18 00:08:32 GMT 2007
    
    
  
On Tue, Dec 18, 2007 at 12:49:50AM +0100, Petr Nejedly wrote:
> > [1] Are there any recent/accurate informations on the object layout of Sun's
> > VM?  The best I've found is this:
> > http://java.sun.com/developer/technicalArticles/Networking/HotSpot/
> > But it's almost 10 years old.
> 
> The information there is right.
> "new Object()" is 8B (assuming 32bit JVM), as is any stateless instance.
> Object[0] and Object[1] are both 16B, because HotSpot has 8B object granularity.
Thank you for the information.
> If the merging code ever gets in the way and parse all the timestamps
> (which it used to do a month ago, hopefully got fixed by latest improvement
> in the MergeVisitor), you'll get another Date instance.
It still did until a minute ago.  But I thought you had an optimized version
of the merging code?
> > By not using a reference type we could save 24 bytes here (one pointer + one
> > header).
> 12B only (do you count with 8B words or what?)
Yes, I'm on a 64-bit machine.
> But imagine this:
> 
> public interface Coordinate {
>      public double getLatitude();
>      public double getLongitude();
> }
> 
> public class Node implements Coordinate {
>      private double lat, lon;
> }
> 
> Of course we can afford that only because Coordinate has no logic attached,
> otherwise we'd need to duplicate the logic in Node.
But we'd still be duplicating the same code wherever we want to store a
coordinate, so this is only a last resort.
  Gabriel.
    
    
More information about the josm-dev
mailing list