我在使用Roslyn编译为动态程序集时遇到了性能问题。编译大约需要3秒,而使用CodeDom编译器编译相同代码需要大约300毫秒。这是我用来进行编译的代码的简化版本:varcompilation=CSharpCompilation.Create("UserPayRules.dll",syntaxTrees,assembliesToAdd);using(varstream=newMemoryStream()){stopWatch.Start();varresult=compilation.Emit(stream);stopWatch.Stop();Debug.WriteLine("Com