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

Deduplicate in-memory Settings #260

Merged
merged 14 commits into from
Mar 23, 2024
Merged

Deduplicate in-memory Settings #260

merged 14 commits into from
Mar 23, 2024

Conversation

hasezoey
Copy link
Contributor

This PR refactors all code handling Settings which previously cloned everything, now there is only ever 1 instance active in each binary (except while in the tui config editor), in more details:

  • refactor all handling of Settings to not clone the whole instances anymore and use shared access
  • update playback::PlayerTrait's volume* and speed* function to always return the new value
  • tui::ui::components::tag_editor::te_input & tui::ui::components::config_editor::general refactor to be easier handle-able (and remove some duplicate code)

for whats it worth, some stats:

Memory changes (i dont know if i collected it correctly, collected from the debug builds):
(master(008aae4) -> PR(7993fa6))
termusic-server VSZ 2191644 KB -> 2191632 KB [-12 KB]
termusic-server RSS 85056 KB -> 86200 KB [+1144 KB]
termusic VSZ 2768932 KB -> 2768656 KB [-276 KB]
termusic RSS 71692 KB -> 71412 KB [-280 KB]

Binary size:
debug termusic-server 292697872 Bytes -> 292756224 Bytes [+58352 Bytes (~57KB)]
release termusic-server 23586664 Bytes -> 23556736 Bytes [-29928 Bytes (~29KB)]
debug termusic 312275448 Bytes -> 312431664 Bytes [+156216 KB(~153KB)]
release termusic 30627376 Bytes -> 30579824 Bytes [-47552 KB(~46KB)]

even if the sizes are not much different (even getting bigger in debug), this way we wont have stale data or duplicate data in memory

re #214

hasezoey added 14 commits March 23, 2024 16:45
and make this the source-of-truth.
further refactorings incoming.
instead of cloning and getting stale
also in gstreamer fix a little inconsistentcy
…): accept "Keys" instead of "Settings"

only pass around what is actually necessary
… accept "Keys" instead of "Settings"

only pass around what is actually necessary
…function

avoids a clone and its the only place its used
…): accept "Keys" instead of "Settings"

only pass around what is actually necessary
…handle_radio_ev" calls to require no cloning
…handle_input_ev" calls to require no cloning
@tramhao tramhao merged commit 1c58cae into tramhao:master Mar 23, 2024
4 checks passed
@hasezoey hasezoey deleted the fixSettings branch March 24, 2024 11:35
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