Skip to content

refactor: store OSM node IDs only for tower nodes using a compact array - #118

Merged
aoles merged 2 commits into
ors_4.0from
refactor/avoid_using_hashmap
Jul 24, 2026
Merged

refactor: store OSM node IDs only for tower nodes using a compact array#118
aoles merged 2 commits into
ors_4.0from
refactor/avoid_using_hashmap

Conversation

@aoles

@aoles aoles commented Jul 24, 2026

Copy link
Copy Markdown
Member

The previous <Integer, Long> hash map approach was unscalable for larger datasets like the full planet file. This optimization reduces memory usage via two key insights:

  1. It is not necessary to store the mapping for pillar nodes.
  2. Tower node IDs are sequentially assigned from zero, allowing them to serve as direct indices into a primitive long[] array of OSM IDs.

A smaller <Long, Long> auxiliary hash map handles the mapping of artificial OSM IDs back to their original counterparts.

aoles added 2 commits July 24, 2026 12:44
The previous `<Integer, Long>` hash map approach was unscalable for larger datasets like the full planet file. This optimization reduces memory usage via two key insights:
1. It is not necessary to store the mapping for pillar nodes.
2. Tower node IDs are sequentially assigned from zero, allowing them to serve as direct indices into a primitive long[] array of OSM IDs. 
A smaller <Long, Long> auxiliary hash map handles the mapping of artificial OSM IDs back to their original counterparts.
@aoles
aoles requested a review from Copilot July 24, 2026 11:07

This comment was marked as off-topic.

@aoles
aoles requested review from Copilot, jhaeu and jlink July 24, 2026 11:08

This comment was marked as off-topic.

@aoles
aoles enabled auto-merge (squash) July 24, 2026 11:14

@jhaeu jhaeu left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - one optional renaming suggestion


// ORS-GH MOD START - additional methods
private void addOsmNodeIdById(int id, long osmId) {
private void addOsmNodeIdById(int towerId, long osmId) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about renaming to addOsmNodeIdByTowerNodeId ?

@aoles
aoles merged commit 6a5ced1 into ors_4.0 Jul 24, 2026
2 checks passed
@aoles
aoles deleted the refactor/avoid_using_hashmap branch July 24, 2026 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants