public void StylePerformance() { FileInfo file = new FileInfo(@"c:\data\work\seamlessweb\manhattan\src\businesslogic\invoice.cs"); String contents = file.OpenText().ReadToEnd(); CSharpStyler styler = new CSharpStyler(); Timer timer = new Timer(); for (Int32 i = 0; i < 10; i++) { styler.Style(contents); } timer.Stop(); // before changes, best I saw for 10 iterations was 13500ms Console.Out.WriteLine(timer.TimeSpan.TotalMilliseconds); }
public Form1() { InitializeComponent(); Editor = new SimpleEditor(); Editor.Dock = DockStyle.Fill; Editor.Name = "Editor"; CSharpStyler styler = new CSharpStyler(); Editor.Styler = styler; Editor.SetKeywords(0, KEYWORDS); Editor.TextChanged += textBoxCode_TextChangedAsync; panelCodeEditor.Controls.Add(Editor); // Load templates from directory. Templates = GetTemplates().ToDictionary(m => m, m => m); comboBoxQuickTemplate.DataSource = new BindingSource(Templates, null); comboBoxQuickTemplate.DisplayMember = "Value"; comboBoxQuickTemplate.ValueMember = "Key"; // Get ready to work. //textBoxCode.SelectionStart = textBoxCode.TextLength; //textBoxCode.ScrollToCaret(); }