Modify

Opened 11 years ago

Closed 11 years ago

#9002 closed enhancement (fixed)

[patch] Coordinates internal improvements

Reported by: shinigami Owned by: team
Priority: normal Milestone:
Component: Core Version:
Keywords: Cc:

Description

QuadBuckets.QBLevel is changed to static class, it allows direct creation of QBLevel[] without reflection - see getChildren().
hasChildren() result is now cached.
firstChild()/next_sibling() works without repetitive creation of array of children.
matches() has faster way for Node primitives.

Attachments (3)

quads.diff (18.6 KB ) - added by shinigami 11 years ago.
quads2.diff (1.6 KB ) - added by shinigami 11 years ago.
fix
nodes.diff (6.4 KB ) - added by shinigami 11 years ago.

Download all attachments as: .zip

Change History (17)

by shinigami, 11 years ago

Attachment: quads.diff added

comment:1 by Don-vip, 11 years ago

Summary: QuadBuckets[patch] QuadBuckets improvements

Don't forget [patch] in ticket title, we have a report for them :)

comment:2 by Don-vip, 11 years ago

Resolution: fixed
Status: newclosed

In 6178/josm:

fix #9002 - QuadBuckets improvements (patch by shinigami)

comment:3 by shinigami, 11 years ago

Oki:)

Btw. to you have stats about environments users have (memory, cores,..), dataset sizes and so?

comment:4 by Don-vip, 11 years ago

Right now, no. The best I can give you is OS and architecture (32/64 bits) stats.

comment:6 by shinigami, 11 years ago

hm, I runned it and it was ok, will check it again..

by shinigami, 11 years ago

Attachment: quads2.diff added

fix

comment:7 by Don-vip, 11 years ago

In 6181/josm:

see #9002 - fix QuadBuckets

in reply to:  4 comment:8 by shinigami, 11 years ago

Replying to Don-vip:

Right now, no. The best I can give you is OS and architecture (32/64 bits) stats.

I asked because I made change in Node/NodeData, replacing doubles with LatLon and EastNorth instances. There were written that it was inlined because of lower memory usage, but now, when LL/NE are immutable and can be shared, overhead wouldn't be so big. In worst case (every node has uniq. LL and precounted EN) it takes ~2x more memory (2 pointers + 2 objects), which makes ~30MB memory on 1M nodes, so nothing fatal.. In best case (node without or shared LL/EN) it takes 1/4 (just two pointers).

Other plus is, it removes loots of creations of new LatLon/EastNorth objects;).

by shinigami, 11 years ago

Attachment: nodes.diff added

comment:9 by shinigami, 11 years ago

here is patch;)

comment:10 by Don-vip, 11 years ago

Resolution: fixed
Status: closedreopened
Summary: [patch] QuadBuckets improvements[patch] Coordinates internal improvements

I think we are more often in the worst case rather than best or even intermediate state.

comment:11 by anonymous, 11 years ago

But still it is not so much memory and it saves lots of operations. Similar problem is with BBox and Bounds.

Other problem is nearly no one caches return val of getCoor(), its common to use it as if (n.getCoor()!=null){n.getCoor().lat().. n.getCoor().lon()...} and similar "effective" constructs.

comment:12 by bastiK, 11 years ago

Yes, it is much memory. As the number of Node instances scales with the size of the dataset, this is exactly the place where memory optimization is important. You can open files of several hundred MB in JOSM, so it adds up.

Basically you are reverting [4126] which I think was a nice optimization.

Can we close this ticket?

comment:13 by shinigami, 11 years ago

Not exactly, need not make defensive copies now, so it saves short living mess and allow share objects.
But you are right, I tried it and it consumes about 25% more memory (it makes 0.5GB for all Norway - 2.34GB osm file). Understand that not everyone has 32gigs yet:).

comment:14 by stoecker, 11 years ago

Resolution: fixed
Status: reopenedclosed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.