Skip to content

Conversation

@frank-weindel
Copy link
Contributor

@frank-weindel frank-weindel commented Jan 29, 2024

The goal is to reduce the number of object allocations and hence garbage collection memory pressure on objects that may be rapidly replaced during animations. In this case, the clipping rect was being newly allocated each time it was changed. This change makes it so there is only one clipping rect per Node that is persistently kept throughout the lifetime of the Node. The SDF text renderer also keeps a persistent clipping rect for its purposes.

This does not seem to have an impact on raw FPS performance:

Before Change:
---------------------------------
Average FPS: 25.16
Median FPS: 25
P01 FPS: 14
P05 FPS: 23
P25 FPS: 25
Std Dev FPS: 2.0135540717845153
Num samples: 100
---------------------------------
---------------------------------
Average FPS: 25.7
Median FPS: 26
P01 FPS: 14
P05 FPS: 24
P25 FPS: 26
Std Dev FPS: 2.2516660498395376
Num samples: 100
---------------------------------
---------------------------------
Average FPS: 25.55
Median FPS: 26
P01 FPS: 14
P05 FPS: 23
P25 FPS: 26
Std Dev FPS: 2.165063509461096
Num samples: 100
---------------------------------

After Change:
---------------------------------
Average FPS: 25.83
Median FPS: 26
P01 FPS: 14
P05 FPS: 23
P25 FPS: 26
Std Dev FPS: 2.2805920283996444
Num samples: 100
---------------------------------
---------------------------------
Average FPS: 24.82
Median FPS: 25
P01 FPS: 13
P05 FPS: 24
P25 FPS: 25
Std Dev FPS: 2.251133048044917
Num samples: 100
---------------------------------
---------------------------------
Average FPS: 25.41
Median FPS: 26
P01 FPS: 14
P05 FPS: 23
P25 FPS: 25
Std Dev FPS: 2.0203712530126703
Num samples: 100
---------------------------------

…e object

The goal is to reduce the number of object allocations and hence garbage collection memory
pressure on objects that may be rapidly replaced during animations. In this case, the
clipping rect was being newly allocated each time it was changed. This change makes it
so there is only one clipping rect per Node that is persistently kept throughout the lifetime
of the Node. The SDF text renderer also keeps a persistent clipping rect for its purposes.

This does not seem to have an impact on raw FPS performance.
@frank-weindel frank-weindel changed the title Instantiate a single clipping Rect for each Node / Text Renderer Stat… Instantiate a single clipping Rect for each Node / Text Renderer State Jan 29, 2024
@frank-weindel frank-weindel added this pull request to the merge queue Jan 30, 2024
Merged via the queue into main with commit 0ce87ed Jan 30, 2024
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.

3 participants