itwinjs-core
itwinjs-core copied to clipboard
Add performance monitors to core
In the iTwin Viewer v2.x we added the following metrics to track performance and logged them to the browser's performance timeline
- Duration of startup to the initialization of iTwin.js services
- Duration of startup to the establishment of a connection to the iModel
- Duration of startup to the creation of a view state for the iModel
- Duration of startup until the last tile is loaded and rendered for the initial iModel view
We want to move this monitoring into core so applications that do not rely on the Viewer component can instrument their's with the same metrics for a better comparison of what their performance should look like.
See related prs in the viewer:
- https://github.com/iTwin/viewer/pull/86
- https://github.com/iTwin/viewer/pull/123
https://web.dev/user-timings/
Please do not add any assumptions to packages like core-frontend like "there is exactly one iModel", "there is exactly one viewport", "iModel is being opened from hub", etc.
Agreed, I anticipate there will be a timing for each of these discrete events and some may have multiple happening at the same time. Though, there are cases where there will be a single fixed time such as IModelApp.startup
since it should only happen once within a session.
@aruniverse on this metric, "duration of startup until the last tile is loaded and rendered for the initial iModel view", I'm not sure if we can ever accurately track (or even really need) to track when all tiles are loaded in a given view. Did you mean to say first tile loaded rather than last?
IModelApp.startup since it should only happen once within a session.
I seem to recall the Synchro team (used to?) shut down and restart IModelApp under certain circumstances.
@aruniverse on this metric, "duration of startup until the last tile is loaded and rendered for the initial iModel view", I'm not sure if we can ever accurately track (or even really need) to track when all tiles are loaded in a given view. Did you mean to say first tile loaded rather than last?
Yea this one we need to rethink how we want to handle this. We captured this event in ViewCreator3d.createDefaultViewState or at the app level if they didnt use the default view state.
This metric can be undefined under real usage if the user never stops moving around in the vp, but for testing purposes I'd hope we would always be able to track when all tiles are loaded.
I don't know if the way we've currently been tracking time to first tile is accurate yet, but yea we can add that metric to track as well.
move to 3.5