[josm-dev] Jumbo Patch

Gabriel Ebner ge at gabrielebner.at
Mon Dec 17 23:27:45 GMT 2007


On Tue, Dec 18, 2007 at 12:00:35AM +0100, Frederik Ramm wrote:
> Hi,
> 
> >> If people are really concerned about memory usage and such (as in
> >> "you can't keep a list of ways with every node as even the empty
> >> list will consume 80 bytes") there's just no beating good old C++.
> >
> > Really? Oh come on, you need to know your libraries, regardless of the 
> > language.
> 
> Libraries? For the task at hand I was thinking about a null-terminated
> array of pointers to way objects. For every node this would mean
> exactly (number of nodes in way+1) * 4 bytes. On the whole, since
> nodes belong to one way on average, that would amount to 8 bytes for
> every node in your dataset.

If my informations are correct, this would take just two more words (for the
object header) if you were using java arrays.  It's not that big of a
difference.

IMHO the biggest memory issue in java is that everything is a reference.  You
can only have an array of references to LatLon objects, and this takes not
only n pointers, but additionally 2n words for the object headers, i.e. 24
extra bytes per element on my machine.

Of course, you could use two arrays of doubles, but that is just a dirty hack
and you'll have to roll your own version of ArrayList.

> I am leaning towards the second interpretation, i.e. just accept it
> that things get slow when you edit a whole city on last year's desktop
> hardware and get on with it.

The reason that large datasets are slow to render and edit isn't only java's
fault.  We're doing no spatial indexing at all.  We don't do any kind of
information reduction at low zoom levels.  We don't do any sort of
reverse-lookup tables.  We're using linked lists to store the primitives...

  Gabriel.




More information about the josm-dev mailing list