[josm-dev] Jumbo Patch
Petr.Nejedly at Sun.COM
Sun Dec 16 00:11:00 GMT 2007
Dave Hansen napsal(a):
> Privatize Way.nodes. We need to do this to keep the cache consistent.
> We also need a ton of new accessor functions. These need some more
> work. This is the bulk of the "core" patch.
While I have already voiced in my opinion on encapsulation and how
badly is it needed in JOSM, I must say that your approach is certainly
far from what would I do.
Why don't you simply export read-only view over the nodes list
(Collections.unmodifiableList(nodes))? That would cover most of the
use cases and you can get rid or many of the methods. And there are
ways how to do even the modification accesses w/o so many methods.
And I have to oppose strongly (as a user) against Node.wayList.
It would have huge impact on the memory requirements.
Empty array list costs ~70B. Per Node, that means 35MB more memory
needed for my use case (>500.000 nodes) (35% increase over current
consumption of my, slightly patched JOSM version) Even if you did
it right (limit the capacity of the list), it would still be ~40B/node
increase. Only if you did it really well, you could get it to 4B/node
benefiting from the fact that most nodes take part in only one way,
but still, this doesn't belong into the data layer as it causes
close data duplication and all the problems related to that.
Petr "Nenik" Nejedly, NetBeans/Sun Microsystems, http://www.netbeans.org
355/113 -- Not the famous irrational number PI, but an incredible simulation!
More information about the josm-dev