BHoM_Engine: ReflectAssemblyOnLoad to only reflect assemblies in BHoM folder
- Dominant language
- C#
- Stars
- 30
- Forks
- 13
- Avg merge
- 7d 10h
- Merged PRs (30d)
- 5
Description
#### Description:
Did a quick investigation of the load time of BHoM in Grasshopper as well as Excel and found that the load speed of these UIs could be significantly improved by updating the automatic assembly extraction to be filtered to only automatically reflect dlls in the BHoM folder.
https://github.com/BHoM/BHoM_Engine/blob/de6a8b076ee0f809700f7923a0cf7d32b4a0233c/BHoM_Engine/Objects/Global.cs#L100-L103
could be changed to something like:
```
private static void ReflectAssemblyOnLoad(object sender, AssemblyLoadEventArgs args)
{
Assembly assembly = args?.LoadedAssembly;
if (assembly != null)
{
if (!string.IsNullOrEmpty(assembly.Location) && Query.BHoMFolder() == System.IO.Path.GetDirectoryName(assembly.Location))
{
Compute.ExtractAssembly(assembly);
}
}
}
```
As an alternative we could use similar Regex filters that are used in the call to LoadAllAssemblies and also then have the regex loaded by a config that could be set up based on the current environment being loaded. Have not yet tested this latter option, but do not see any real reason why it should not work.
DOing this will significantly improve the load time of at least GH and Excel, as it seems like a lot of the time taken to load them is the assembly decomposition of the full appdomain which can be quite big.
Contributor guide
Assessment
This issue has not been assessed yet.