Skip to content

[PERFORMANCE] General Optimizations + Dynamic Storyboard Rendering#264

Open
menvae wants to merge 21 commits into
InventiveRhythm:mainfrom
menvae:gen-opt
Open

[PERFORMANCE] General Optimizations + Dynamic Storyboard Rendering#264
menvae wants to merge 21 commits into
InventiveRhythm:mainfrom
menvae:gen-opt

Conversation

@menvae
Copy link
Copy Markdown
Contributor

@menvae menvae commented Apr 27, 2026

Requires:

This Pull Request does not have any optimizations gameplay-wise

This Pull Request aims to optimize as much of static drawables as possible, drawables that do not update often and are heavily nested. By using cached buffered containers we are able to substantially improve our game's performance.
On top of this it also implements the long awaited Dynamic Storyboarding system which no words can describe how much better the storyboard editor feels now.


Cached Buffered Container Principal

In most of these static drawables you have load wrappers for async loaded sprites so we keep updating it until it has fully loaded and add it to a LoadingState flags enums when there is more than one thing that is asynchronously loaded.
We redraw the drawable based on its LatestTransformTime (for THIS drawable, LatestTransformTime isn't affected by the drawable's children), load state and if it is hovered or has a specific state that it should always be redrawn in like when a mapset needs updating or when downloading a replay.


Huge Optimzations

  • optimized File Select (again)
    • we now use CullableFlowContainer instead of the old convoluted streaming method which was unreliable
  • optimized Song Select
    • DrawableMapSetHeader, DrawableMapSetDifficulty and ScoreListEntry are all static most of time and heavily nested, especially DrawableMapSetHeader.
  • optimized PointsList
    • more often than not this is a huge performance killer for the editor due to the sheer amount of drawables we have to load and draw, we use CullableFlowContainer to cull points that are not visible.
  • optimized StoryboardTab rebuilding/rendering
    • We now keep track of all storyboard elements allowing us to only update what we need, this means too that we don't need idle tracker for normal non-script generated elements as it now updates instantly
    • not all script elements are loaded by default, now it will only load when in proximity to it
    • loading icon now is shown/hidden depending on whether a region is loaded

Medium Optimizations

  • optimized TimelineTags
    • now this could be added in any optimization category depending on how many tags and how often you interact with it but, adding it to Medium seems more logical
  • optimized ProfileScore (static & nested)
  • optimized MapCard (BrowseOverlay & ProfileOverlay) (static & nested)
    • technically MapCard could qualify as a huge perf improvement since it cuts down on drawcalls by a ton but I'll keep it in medium
  • optimized cropping of banners
    • Image.Load can already take a raw bytes buffer so no need to convert to array, also we now use.. using though I haven't checked if it makes a difference but it's good practice for memory management and doesn't hurt to do

Minor Optimizations

  • optimized TimelineDensity
  • optimized game loading
    • lazily load chat messages instead of in game start up.
      • This speeds up loading times by A LOT because we don't have to wait for chat messages and also causes a lag spike when waiting. This isn't in Medium Optimizations because this only affects start up and not many people would actually notice this.
    • preload ffmpeg libs/device contexts
      • this might seem a little misleading saying that it preloads the libraries but it's a small optimization to create and cache the contexts instead of doing it on-demand.

Changes

  • use DelayedLoadWrapper instead of DelayedLoadUnloadWrapper because DelayedLoadUnloadWrapper needs to be always updated to work properly which defeats the purpose of caching this drawable in the first place, so to unload it we unload it inside DrawableMapSetItem
  • removed file browser streaming option (with its strings) since that's now replaced with a much more reliable method
  • Storyboard Animation now has a ParentElement field which allows us to actually rebuild specific elements when animations are updated
  • removed a LINQ expression in ScoreListTab (line 300) that was inefficient at indexing and replaced with a normal for loop
  • each script's drawables are now put in a dedicated Compound. this is for ease of use. There could probably be a better way but this works.

Try It Yourself:

Compare between steam version and this branch

  • new PointsList perf: https://fluxis.flux.moe/set/1658

    • Open the editor and go to design and try using the design sidebar
  • new Dynamic Storyboard: https://fluxis.flux.moe/set/1652

    • Go to storyboard and try adjusting params of any elements
  • new Song Select perf

    • This one's effect is pretty obvious but if your pc is borrowed from nasa you might consider running in debug or setting frame limiter to Unlimited
  • new File Select perf

    • This one is also really obvious, if you want an actual stress test, if you're on windows go to C:\Windows\WinSxS. I don't know if there is a directory like this on linux but probably not because windows sucks and it loves eating your storage space.

menvae added 16 commits April 27, 2026 19:47
(update to gen-opt branch NOT upstream)
+ probably better memory management from 'using'
+ line 300 ScoreListTab.cs possible multi quering fixed
- profile score & MapCard opt for profile overlay
- MapCard opt for browse overlay
- using CullableContainer is much more reliable & maintainable AND cleaner than our old stream method

+ removed the stream option & its strings since we don't actually need it anymore
+ we don't save much on drawcalls but there is defenitely a big performance improvement if we have a bunch of tags idiling

+ make positioning and tag creating more stable
this one is a very small optimization but it's easy and doesn't hurt to have
I forgot what I was going to say here
+ add queuing/debouncing for static sb elements' updating
+ fix clipping for timeline tag container
+ improve after load time for mapset header drawables
@menvae menvae changed the title General Optimizations [PERFORMANCE] General Optimizations + Dynamic Storyboard Rendering May 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant