-
开启前 程序占用内存大约600MB,预热后1.2GB-1.4GB 左右 |
Beta Was this translation helpful? Give feedback.
Answered by
hyzx86
Jan 18, 2023
Replies: 2 comments
Answer selected by
hyzx86
-
根据个人的需求, 以下是一个比较简洁的加载, 如果只需要输出helloworld 可以继续精简. 内存涨幅大概40M 左右. NatashaInitializer.Preheating((asmName, name) => {
if (name!=null)
{
if (name!.Contains("System"))
{
if (
name!.Contains("Net") ||
name!.Contains("Xml") ||
name!.Contains("IO") ||
name!.Contains("Reflection") ||
name!.Contains("Threading") ||
name!.Contains("Security") ||
name!.Contains("Diagnostics") ||
name!.Contains("Data") ||
name!.Contains("Resources.") ||
name!.Contains("Drawing") ||
name!.Contains("Text") ||
name!.Contains("Globalization") ||
name!.Contains("Service") ||
name!.Contains("Web") ||
name!.Contains("Window") ||
name!.Contains("ComponentModel")
)
{
return true;
}
return false;
}
if (name!.Contains("Natasha"))
{
return false;
}
if (name!.Contains("ConsoleApp16"))
{
return false;
}
}
return true;
}); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
使用预热的重载方法
😘 感谢大帅!