Files
OpenFrontIO/src
Bornasm c79af121a8 Improve performance by reordering rendering layers (#1947)
## Description:

The issue raised describes context.restore using too much CPU. This PR
changes the layer order to reduce the number of context.restore and
context.save calls.

The order plays a role because every time a layer has to swap between
using transform (triggered by a layer's shouldTransform function
returning true) and not, it has to call context.save/context.restore.
This change simply reorders the layers so all layers which need
transform are grouped together at the start, and those who don't are at
the end.

Regarding testing, initially my plan was to add unit tests as this is an
easy thing to overlook. But the current testing setup doesn't play
nicely with pixijs, litjs, and a few others. I didn't want to make large
changes to the testing setup here, so instead I left a comment to remind
anyone making changes to pay attention to the order.
 
Fixes #1894

## Please complete the following:

- [X] I have added screenshots for all UI updates
- [X] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [X] I have added relevant tests to the test directory
- [X] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced

## Please put your Discord username so you can be contacted if a bug or
regression is found:

Bornasm
2025-08-27 18:37:04 -04:00
..
2025-07-01 17:09:18 -07:00