[Bug]: Performance regression in frame rendering
### What happened?

PR #4979 made performance significantly worse on a canvas we have with a lot of frames. After this change it has very low fps when zooming in or out. This happens because it calls `measureTextSpans` in `getFrameHeadingInfo` which is expensive.

### How can we reproduce the bug?

1. Create many frames
2. Zoom in or out
3. Observe lagging/low fps

### What browsers are you seeing the problem on?

Chrome

### Where did this happen?

The developer package

### Contact Details

_No response_

### Code of Conduct

- [x] I agree to follow this project's Code of Conduct