Closed CodeWringer closed 1 year ago
Upon current investigation, it appears that the view model system is taking up at least half a second on each render. These times must be reduced.
Upon comparison with other document sheets, it appears only actor sheets take this long to render. And it makes sense they would take longer.
An actor sheet loads all its templates and view models up-front. The more embedded documents there are, the longer this takes. But when changing data on one of the tabs of an actor sheet, for example on a skill document, then the user might not currently be interested in the data on their health tab. It is really unnecessary to load the health tab data right away.
Also, very long lists of skills are to be expected. The number of skills on an actor should not affect the loading quite so much.
The following approaches might help mitigate the perceivable performance problem:
getData
method of the sheet classes. That is where view models are instantiated, currently. game.ambersteel.viewModels
property. See #185
Every time a field is updated, the re-render takes up to a second or more. It should be faster than that. This is probably related to the fact that skill abilities are stored in arrays and that the update delta is much larger than it really needs to be.
Add a small delay, which is reset upon every value change. Only once this delay has elapsed, send the update.Hopefully, this helps with values changing very rapidly. A prime example of this are the number spinners, which can be 'scrolled'.