tramhao / termusic

Music Player TUI written in Rust
GNU General Public License v3.0
968 stars 42 forks source link

Deduplicate in-memory Settings #260

Closed hasezoey closed 3 months ago

hasezoey commented 3 months ago

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:

for whats it worth, some stats:

Memory changes (i dont know if i collected it correctly, collected from the debug builds): (master(008aae4e8dff7e451281ac164e9f0b1dc06c371e) -> PR(7993fa63c9b2defd9b47e23449c5d7d76a2cf8d5)) 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