Skip to content

Use byte-based storage for edges#2993

Merged
karussell merged 21 commits intomasterfrom
bytes_store_edge_flags
May 1, 2024
Merged

Use byte-based storage for edges#2993
karussell merged 21 commits intomasterfrom
bytes_store_edge_flags

Conversation

@karussell
Copy link
Copy Markdown
Member

@karussell karussell commented Apr 29, 2024

Replaces #2986 but with less changes.

Currently we store all properties like the distance or nodeA/B ID to the edges DataAccess as integer, which is a bit limiting as every property has to fit in one integer and if not, it will require two integers (instead of expanding to e.g. 5 bytes).

With this change the edges is byte-based and we can use only 5 bytes for the georef (see #2978) and the edge flags are stored with byte-precision too i.e. this change can reduce the storage requirement by up to 6 bytes (e.g. up to 3 bytes for the edge flags plus 3 bytes less for georef).

There is only a minor slowdown of 2-5% for routing and CH/LM preparation. As there was a minor speed-up found in this process the overall slowdown regarding the latest stable for the routing is neglectable.

Later this change will help if other edge properties like the edge IDs or link ID grow beyond 4 bytes.

@karussell karussell added this to the 10.0 milestone Apr 29, 2024
return BitUtil.LITTLE.toULong5(bytes, 0);
int int0 = edges.getInt(edgePointer + E_GEO);
byte byte5 = edges.getByte(edgePointer + E_GEO + 4);
return BitUtil.LITTLE.toLong(int0, byte5);
Copy link
Copy Markdown
Member Author

@karussell karussell Apr 30, 2024

Choose a reason for hiding this comment

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

I think byte5 & 0xFF is required because otherwise the long could get negative if the highest bit of byte5 is set. And there seems to be no speed is lost for the byte-array approach: so let's keep fromULong5 and toULong5.

@karussell karussell merged commit ee68d2b into master May 1, 2024
@karussell karussell deleted the bytes_store_edge_flags branch May 1, 2024 13:37
karussell added a commit that referenced this pull request May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants