iTwin / itwinjs-core

Monorepo for iTwin.js Library
https://www.itwinjs.org
MIT License
606 stars 210 forks source link

Add performance monitors to core #4115

Open aruniverse opened 2 years ago

aruniverse commented 2 years ago

In the iTwin Viewer v2.x we added the following metrics to track performance and logged them to the browser's performance timeline

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://web.dev/user-timings/

pmconne commented 2 years ago

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.

calebmshafer commented 2 years ago

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?

pmconne commented 2 years ago

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 commented 2 years ago

@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.

calebmshafer commented 2 years ago

move to 3.5