Editor performance ...
 

Editor performance bug and fix  

  RSS

alpha_cast
(@alpha_cast)
Joined: 1 year ago
Posts: 15
29/05/2018 7:02 am  

I've been experiencing hitches in editor performance while using Archimatix and decided to investigate.

I especially noticed an editor hitch of a couple of seconds when switching between scene view objects with an AXModel component, so I did a bit of profiling.

Archimatix profile

When I dug into `ArchimatixEngine.establishPaths()` I found that there are 2 instances of the following code which are taking about 1.4 seconds each on my machine (i7 with SSD).

FileInfo[] files = info.GetFiles("AXChangeLog.txt", SearchOption.AllDirectories);

I have a fix (I really appreciate the code being distributed with the plugin) which involves caching the file path rather than searching for it again each time, while still handling cases where the file moves or is updated for some reason. Is the developer(s) of Archimatix open to accepting PRs or contributions like this? If so what's the best way to submit it?

Cheers,

Frank.


Quote
Rory
 Rory
(@rory)
Admin
Joined: 2 years ago
Posts: 44
29/05/2018 1:04 pm  

Hi Frank,

Thanks for investigating this. Finding the location of the AXChangeLog.txt is a brute force means of checking to see if the user has moved the AX folder elsewhere from the Assets root. The actual file searched for is arbitrary, but I did not want to search for "Archimatix" in case the user created folders elsewhere with that name.  Of course, if it were required that the Archimatix folder sits at the Assets root, then there would be no need for the search. The absolute folder structure is required for library file saving, etc, that can't use the AssetDatabase tools. It would be great if there was some other way to check the location of the Archimatix folder when the AssetDatabase changes. 

Cheers,

Rory


ReplyQuote
alpha_cast
(@alpha_cast)
Joined: 1 year ago
Posts: 15
29/05/2018 8:45 pm  

Yeah, I figured that's why you were doing it. The method I've used should still pick up the case where the folder gets moved during runtime because it checks to see if the file is still in the cached location each time and if it's not then it does another full directory walk to find it.

I did also play with searching for the AXChangeLog as a text asset in the AssetDatabase, which also works and is very fast. You mentioned that you can't use the AssetDatabase tools for the library file saving, but could it be used to find the AXChangeLog file, and then you can use normal file operations for the library?

I'd be happy to code up these cases so you can see what I mean and make sure they work, if you like.


ReplyQuote
Rory
 Rory
(@rory)
Admin
Joined: 2 years ago
Posts: 44
29/05/2018 11:55 pm  

Thanks for your help with this, Frank. I revamped everything so that it rarely does the folder crawl. As you say, the AssetDatabase tools can grab a TextAsset now, so I could get the changeLog quickly. I forgot that the search for the location of Archimatix was based on the folder name and that the changeLog was checked after an AssetDatabase change so that AX can check to see if the AX version changed, and if so , pop up a window. The location of AX is now stored in editor prefs and only if an AssetDatabase.IsValidFolder fails does it do the crawl (which is I think what you suggested). 

I am glad you found this inefficiency. If users had a project with many assets and plugins, that crawl was a doozy. It also did the crawl three times per asset database change! 

I will post version 1.1.5 to the Assetstore in the morning.  ? 


ReplyQuote
alpha_cast
(@alpha_cast)
Joined: 1 year ago
Posts: 15
30/05/2018 1:00 am  

Great! Awesome to hear! 😀


ReplyQuote
Share:
  
Working

Please Login or Register