Open slactjohnson opened 1 week ago
A very very quick profiling session because I got nerd sniped. Disregard the actual numbers here and just look at them relative to each other
```bash
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
/cds/group/pcds/pyps/conda/py39/envs/pcds-5.9.0/lib/python3.9/site-packages/epics/ca.py:1631: UserWarning: ca.get('LTLHN:LD1:LS1:BTPS:Linear:Nominal_RBV') timed out after 5.00 seconds.
warnings.warn(msg % (name(chid), timeout))
/cds/group/pcds/pyps/conda/py39/envs/pcds-5.9.0/lib/python3.9/site-packages/epics/ca.py:1631: UserWarning: ca.get('LTLHN:LS1:BTPS:CurrentLD_RBV') timed out after 5.00 seconds.
warnings.warn(msg % (name(chid), timeout))
/cds/group/pcds/pyps/conda/py39/envs/pcds-5.9.0/lib/python3.9/site-packages/epics/ca.py:1631: UserWarning: ca.get('LTLHN:BTPS:Config:MinPixelChange') timed out after 5.00 seconds.
warnings.warn(msg % (name(chid), timeout))
7993568 function calls (7747470 primitive calls) in 56.666 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
2 0.000 0.000 56.915 28.458 main.py:1(
Zach's the profiling master around here, but I think we can ignore the runpy.py
and main.py
calls since those will be run for as long as I had the ui open. The next culprits are the widget building and device loading. Note that there were a few CA timeouts that we might be waiting on serially here as well.
Thanks Robert! I'll take a closer look when I can.
it's a bit strange that the prefix setters here are taking so much time, but maybe there's a lot of work to do after setting the PV
Expected Behavior
The BTMS UI should open up in a reasonable amount of time, e.g. a few seconds, when launching the GUI.
Current Behavior
The screen currently takes about 13 seconds to open.
Possible Solution
I suspect that at least some of this overhead has to do with the way it's using the happi database and loading typhos screens. There may be ways to lazy-load things to reduce startup time. A splash screen that let's the user know it's loading could also help.
Context
This is long enough that it has made some people press the button several times, or think that the screen is not working.