-
Notifications
You must be signed in to change notification settings - Fork 218
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reduced render time for bars by 60-80%, by caching IsSpatial
In my profiling, GetSpatialColor represents 33% of the time spent inside BarsEffect::Render, just checking buffer.palette.IsSpatial(colorIdx) for every pixel. If you're not using spatial colors, this time is pure wastage. The optimiser can't see deep enough to know that it can cache IsSpatial, so I've done it manually. Despite expecting a saving of only 33%, it's actually more like 60%, because skipping the GetSpatialColor function call also skips all of the maths done to build its parameters, such as `(float)x / (float)buffer.BufferWi`, and `(float)(n % barHt) / (float)barHt`. 5.878s -> 2.184s for my test sequence, that is one bars effect with 3 colours, across all channels. More savings could undoubtedly be had by performing this same optimisation on other effects.
- Loading branch information
Showing
1 changed file
with
22 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters