[OPTIMIZATION?] Copy cache maps instead of assigning #6471
+5
−5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Linked Issues
N/A
Description
Unlike other basic types, arrays and maps aren't automatically copied when you asign them to a variable.
This means that in
FunkinMemory, there are cases where permament cache maps get fully cleared, which hurts performance since the sounds/bitmaps would have to get cached again.I can't say how much this affects performance, as this doesn't affect my computer that heavily, though what I can say is that with this the memory usage won't build up over time the more songs are played in a session, since the cache is cleared after exiting results. From my testing I've had memory usage roll back from 1gb to 0.75gb after exiting a song.
Screenshots/Videos
N/A