Bug - Fixed Inventory Panel Slow to Open

gausie

D̰͕̝͚̤̥̙̐̇̑͗̒e͍͔͎͈͔ͥ̉̔̅́̈l̠̪̜͓̲ͧ̍̈́͛v̻̾ͤe͗̃ͥ̐̊ͬp̔͒ͪ
Staff member
Somewhere to discuss this bug that has already been acknowledged elsewhere
 

gausie

D̰͕̝͚̤̥̙̐̇̑͗̒e͍͔͎͈͔ͥ̉̔̅́̈l̠̪̜͓̲ͧ̍̈́͛v̻̾ͤe͗̃ͥ̐̊ͬp̔͒ͪ
Staff member
I ran some profiling and it seems that opening inventory runs the static block in ScriptManager, which looks like

Java:
static {
  ScriptManager.updateRepoScripts(false);
  ScriptManager.updateInstalledScripts();
}

It seems that in my local version, SVNManager.workingCopyToSVNURL(File) is called by both of those functions and used 13 seconds cumulatively each time.

I can't work out much more from VisualVM (first time using it) but that's somewhere to start...
 

fronobulax

Developer
Staff member
I can't work out much more from VisualVM (first time using it) but that's somewhere to start...

Feel free to share "How To" type instructions and experiences. Since the changes to bookmarks, script menu, etc. there is a noticeable lag in running scripts. I'm pretty sure it is not the synchronization to protect the ScriptMRU list but have not had the tools or understanding to dog deeper.

Also if you figure out why opening the inventory runs the static block in ScriptManager that would be interesting since I not sure why they are related.
 

gausie

D̰͕̝͚̤̥̙̐̇̑͗̒e͍͔͎͈͔ͥ̉̔̅́̈l̠̪̜͓̲ͧ̍̈́͛v̻̾ͤe͗̃ͥ̐̊ͬp̔͒ͪ
Staff member
Also if you figure out why opening the inventory runs the static block in ScriptManager that would be interesting since I not sure why they are related.
This is easy - the cell renderers are shared between all the data frames so the import happens when it is determining what type of data to display
 

heeheehee

Developer
Staff member
Can we move that initialization to a background thread, and block direct reads on that thread completing?

I'm not surprised that an i/o-heavy sequence of operations takes a long time.
 

Veracity

Developer
Staff member
This freezes the GUI while it happens, by the way.

I was running VMF with the gCLI open and the text was scrolling by - until I opened the Inventory Manager.
I stopped scrolling until the frame opened and then it continued.
I don't know if my script was continuing to run. I suspect it was.

So, yeah - that I/O intensive operation REALLY shouldn't be running in Swing's event thread.
 

Veracity

Developer
Staff member
The solution is to not have that static block in ScriptManager.
Put those calls in a method which is called ... somewhere.
Perhaps in a background thread, as heeheehee suggests.
Presumably not when ScriptManager .java is first loaded.

Investigating, finally. :)
 

Veracity

Developer
Staff member
The issue is that ScriptManager initializes the getRepoScripts() and getInstalledScripts() models at initialization.
Other frames - including especially InventoryManager - call a widget which wants to check if a model is one of those.
It isn't. The ONLY Frame which uses those is SvnManagerFrame.
Therefore, I moved the model initialization out of SvnManager into SvnManagerFrame.

 
Top