Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove memref references from each data object #390

Merged
merged 13 commits into from
Dec 21, 2024

Conversation

Jamiras
Copy link
Member

@Jamiras Jamiras commented Dec 13, 2024

Memrefs are managed by the runtime, and were only stored directly in the data objects when calling the old (pre-rc_runtime_t) functions to manage the objects. This PR eliminates the unused reference from the data objects, and provides a container when using the pre-rc_runtime_t functions.

This change saves 8 bytes for every trigger and value, and 40 bytes for every leaderboard (as it contains three triggers and a value) when managed by the runtime (either rc_runtime_t or rc_client_t), which most (if not all) clients should be using. Constructing these items outside of the runtime (legacy support) will allocate an extra 40 bytes per item for managing the chunks (described below).

This also turns the memref collection from a linked list of rc_memref_ts to a linked list of chunks of rc_memref_ts, which eliminates 8 bytes from each memref, but adds 16 bytes for each chunk. The minimum chunk size is 8 elements, so that's a net gain of 48 bytes per chunk, and potentially more when larger chunks are allocated. The initial runtime chunk is 32 elements.

There are also marginal performance gains for processing the memrefs as an array instead of a linked list.

@Jamiras Jamiras added this to the 11.7.0 milestone Dec 13, 2024
@Jamiras Jamiras merged commit 92509d9 into RetroAchievements:develop Dec 21, 2024
7 checks passed
@Jamiras Jamiras deleted the feature/rc_memrefs_t branch December 21, 2024 14:30
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.

1 participant