Change object to byte to reduce overhead

This commit is contained in:
弘韬 张 2021-04-12 19:34:58 +08:00
parent 78d8dbbc14
commit bad5504de4

View file

@ -15,17 +15,17 @@ namespace Flow.Launcher.Core.Plugin
private readonly AssemblyName assemblyName;
private static readonly ConcurrentDictionary<string, object> loadedAssembly;
private static readonly ConcurrentDictionary<string, byte> loadedAssembly;
static PluginAssemblyLoader()
{
var currentAssemblies = AppDomain.CurrentDomain.GetAssemblies();
loadedAssembly = new ConcurrentDictionary<string, object>(
currentAssemblies.Select(x => new KeyValuePair<string, object>(x.FullName, null)));
loadedAssembly = new ConcurrentDictionary<string, byte>(
currentAssemblies.Select(x => new KeyValuePair<string, byte>(x.FullName, default)));
AppDomain.CurrentDomain.AssemblyLoad += (sender, args) =>
{
loadedAssembly[args.LoadedAssembly.FullName] = null;
loadedAssembly[args.LoadedAssembly.FullName] = default;
};
}