From e3bda5b1b489bac4e7ca70e0a29550c47c38f28b Mon Sep 17 00:00:00 2001 From: Ed Harvey Date: Tue, 7 Jun 2016 11:12:43 +1000 Subject: [PATCH] Use preconstructed formatting options Reduce GC pressure by avoiding repeated construction of large options objects --- ILSpy/Languages/CSharpLanguage.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ILSpy/Languages/CSharpLanguage.cs b/ILSpy/Languages/CSharpLanguage.cs index 024996790..9b4f187ab 100644 --- a/ILSpy/Languages/CSharpLanguage.cs +++ b/ILSpy/Languages/CSharpLanguage.cs @@ -548,10 +548,13 @@ namespace ICSharpCode.ILSpy ((ComposedType)astType).PointerRank--; } - astType.AcceptVisitor(new CSharpOutputVisitor(w, FormattingOptionsFactory.CreateAllman())); + astType.AcceptVisitor(new CSharpOutputVisitor(w, TypeToStringFormattingOptions)); return w.ToString(); } + static readonly CSharpFormattingOptions TypeToStringFormattingOptions = FormattingOptionsFactory.CreateEmpty(); + + public override string FormatPropertyName(PropertyDefinition property, bool? isIndexer) { if (property == null)