Skip to content

Switch VertexRef to inheritance#3197

Merged
arnetheduck merged 3 commits intomasterfrom
inherited-vertex
Apr 8, 2025
Merged

Switch VertexRef to inheritance#3197
arnetheduck merged 3 commits intomasterfrom
inherited-vertex

Conversation

@arnetheduck
Copy link
Copy Markdown
Member

The current VertexRef is a composition of two case object types - this layout is inefficient in that each VertexRef instance takes up as much memory as its largest member. Adding to the insult are the two case fields which each take up space.

Here, we use inhertance instead to create optimally sized verticies for each node kind - in particular, the Brach kind kan drop the prefix and reduce its memory usage to a fraction of what it was using before.

The memory savings are instead invested in a larger key cache - when processing blocks for live syncing, key lookups are the source of a significant majority (95%) of database reads - when importing, the key cache is simply allotted to verticies instead.

The current VertexRef is a composition of two case object types - this
layout is inefficient in that each VertexRef instance takes up as much
memory as its largest member. Adding to the insult are the two case
fields which each take up space.

Here, we use inhertance instead to create optimally sized verticies for
each node kind - in particular, the Brach kind kan drop the prefix and
reduce its memory usage to a fraction of what it was using before.

The memory savings are instead invested in a larger key cache - when
processing blocks for live syncing, key lookups are the source of a
significant majority (95%) of database reads - when importing, the key
cache is simply allotted to verticies instead.
The current VertexRef is a composition of two case object types - this
layout is inefficient in that each VertexRef instance takes up as much
memory as its largest member. Adding to the insult are the two case
fields which each take up space.

Here, we use inhertance instead to create optimally sized verticies for
each node kind - in particular, the Brach kind kan drop the prefix and
reduce its memory usage to a fraction of what it was using before.

The memory savings are instead invested in a larger key cache - when
processing blocks for live syncing, key lookups are the source of a
significant majority (95%) of database reads - when importing, the key
cache is simply allotted to verticies instead.
@arnetheduck arnetheduck merged commit a1653e7 into master Apr 8, 2025
@arnetheduck arnetheduck deleted the inherited-vertex branch April 8, 2025 17:44
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.

2 participants