Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indent correcting taking up too much time on large files #6238

Closed
Therzok opened this issue Oct 9, 2018 · 4 comments

Comments

@Therzok
Copy link
Member

commented Oct 9, 2018

Test scenario

Move on line 4856 and move lines up and down.

5.92%   OnKeyPressed  •  6,512 ms  •  5 calls  •  MonoDevelop.Components.Commands.CommandManager.OnKeyPressed(Object, KeyPressEventArgs)
  5.92%   ProcessKeyEvent  •  6,512 ms  •  5 calls  •  MonoDevelop.Components.Commands.CommandManager.ProcessKeyEvent(EventKey)
    5.92%   DispatchCommand  •  6,511 ms  •  4 calls  •  MonoDevelop.Components.Commands.CommandManager.DispatchCommand(Object, Object, Object, CommandSource, Nullable, CommandInfo)
      5.91%   <DispatchCommand>b__1  •  6,498 ms  •  4 calls  •  MonoDevelop.Components.Commands.CommandManager+<>c__DisplayClass107_3.<DispatchCommand>b__1
        5.91%   Run  •  6,498 ms  •  4 calls  •  MonoDevelop.Components.Commands.CommandHandlerInfo.Run(Object, Command)
          5.91%   Invoke  •  6,498 ms  •  4 calls  •  System.Reflection.MethodBase.Invoke(Object, Object[])
            3.01%   OnMoveBlockUp  •  3,309 ms  •  2 calls  •  MonoDevelop.Ide.Editor.Extension.DefaultCommandTextEditorExtension.OnMoveBlockUp
              3.01%   MoveBlockUp  •  3,309 ms  •  2 calls  •  MonoDevelop.Ide.Editor.EditActions.MoveBlockUp(TextEditor)
                3.01%   MoveBlockUp  •  3,309 ms  •  2 calls  •  MonoDevelop.SourceEditor.SourceEditorView.MoveBlockUp
                  2.74%   CorrectIndenting  •  3,020 ms  •  2 calls  •  MonoDevelop.SourceEditor.SourceEditorView.CorrectIndenting
                    2.74%   CorrectIndenting  •  3,020 ms  •  2 calls  •  MonoDevelop.Ide.CodeFormatting.CodeFormatter.CorrectIndenting(PolicyContainer, TextEditor, Int32)
                      2.74%   CorrectIndenting  •  3,020 ms  •  2 calls  •  MonoDevelop.Ide.CodeFormatting.AbstractCodeFormatter.CorrectIndenting(PolicyContainer, TextEditor, Int32)
                        2.74%   CorrectIndentingImplementation  •  3,020 ms  •  2 calls  •  MonoDevelop.CSharp.Formatting.CSharpFormatter.CorrectIndentingImplementation(PolicyContainer, TextEditor, Int32)
                          2.74%   Start  •  3,020 ms  •  2 calls  •  System.Runtime.CompilerServices.AsyncVoidMethodBuilder.Start(ref TStateMachine)
                            2.74%   MoveNext  •  3,020 ms  •  2 calls  •  MonoDevelop.CSharp.Formatting.CSharpFormatter+<CorrectIndentingImplementation>d__7.MoveNext
                              2.71%   Update  •  2,983 ms  •  2 calls  •  ICSharpCode.NRefactory6.CSharp.CSharpIndentEngine.Update(SourceText, Int32)
                                2.21%   Push  •  2,429 ms  •  339,867 calls  •  ICSharpCode.NRefactory6.CSharp.CSharpIndentEngine.Push(Char)
                                  1.00%   Push  •  1,100 ms  •  172,832 calls  •  ICSharpCode.NRefactory6.CSharp.BracesBodyState.Push(Char)
                                    ►0.62%   Push  •  685 ms  •  172,832 calls  •  ICSharpCode.NRefactory6.CSharp.BracketsBodyBaseState.Push(Char)
                                    ►0.12%   OnStatementExit  •  135 ms  •  2,988 calls  •  ICSharpCode.NRefactory6.CSharp.BracesBodyState.OnStatementExit
                                    ►0.10%   SetAlignment  •  108 ms  •  2,832 calls  •  ICSharpCode.NRefactory6.CSharp.Indent.SetAlignment(Int32, Boolean)
                                    ►0.04%   RemoveAlignment  •  49 ms  •  1,570 calls  •  ICSharpCode.NRefactory6.CSharp.Indent.RemoveAlignment
                                     0.04%   op_Equality  •  39 ms  •  172,832 calls  •  System.String.op_Equality(String, String)
                                     0.02%   ToString  •  27 ms  •  172,832 calls  •  System.Text.StringBuilder.ToString
                                     0.00%   2 functions hidden  •  5 ms total  •  11122 calls total
                                  ►0.42%   GetOption  •  459 ms  •  27,578 calls  •  Microsoft.CodeAnalysis.Options.OptionSet.GetOption(PerLanguageOption, String)
                                  ►0.31%   Push  •  345 ms  •  92,335 calls  •  ICSharpCode.NRefactory6.CSharp.ParenthesesBodyState.Push(Char)
                                  ►0.10%   CheckKeyword  •  106 ms  •  12,002 calls  •  ICSharpCode.NRefactory6.CSharp.BracesBodyState.CheckKeyword(String)
                                   0.05%   IsLetterOrDigit  •  50 ms  •  241,166 calls  •  System.Char.IsLetterOrDigit(Char)
                                  ►0.04%   Push  •  43 ms  •  33,686 calls  •  ICSharpCode.NRefactory6.CSharp.LineCommentState.Push(Char)
                                  ►0.04%   Push  •  43 ms  •  31,406 calls  •  ICSharpCode.NRefactory6.CSharp.DocCommentState.Push(Char)
                                   0.03%   IsNewLine  •  28 ms  •  339,867 calls  •  MonoDevelop.Core.Text.NewLine.IsNewLine(Char)
                                   0.02%   get_Length  •  25 ms  •  438,568 calls  •  System.Text.StringBuilder.get_Length
                                   0.02%   Append  •  22 ms  •  268,732 calls  •  System.Text.StringBuilder.Append(Char)
                                   0.01%   12 functions hidden  •  15 ms total  •  117847 calls total
                                   0.01%   ToString  •  15 ms  •  64,284 calls  •  System.Text.StringBuilder.ToString
                                  ►0.01%   Push  •  11 ms  •  746 calls  •  ICSharpCode.NRefactory6.CSharp.SquareBracketsBodyState.Push(Char)
                                   0.01%   IsLetter  •  6 ms  •  98,701 calls  •  System.Char.IsLetter(Char)
                                ►0.38%   get_Item  •  417 ms  •  339,867 calls  •  MonoDevelop.Ide.TypeSystem.MonoDevelopSourceText.get_Item(Int32)
                                 0.05%   get_Offset  •  60 ms  •  679,738 calls  •  ICSharpCode.NRefactory6.CSharp.CSharpIndentEngine.get_Offset
                              ►0.03%   ReplaceText  •  30 ms  •  1 call  •  MonoDevelop.Ide.Editor.TextEditor.ReplaceText(Int32, Int32, String)
                              ►0.01%   Push  •  6 ms  •  62 calls  •  ICSharpCode.NRefactory6.CSharp.CSharpIndentEngine.Push(Char)
                               0.00%   23 functions hidden  •  1 ms total  •  257 calls total
                             0.00%   2 functions hidden  •  0 ms total  •  4 calls total
                           0.00%   2 functions hidden  •  0 ms total  •  4 calls total
                        ►0.00%   get_LineCount  •  0 ms  •  2 calls  •  MonoDevelop.Ide.Editor.TextEditor.get_LineCount
                     0.00%   14 functions hidden  •  0 ms total  •  34 calls total
                  ►0.26%   RunAction  •  288 ms  •  2 calls  •  Mono.TextEditor.MonoTextEditor.RunAction(Action)
                   0.00%   4 functions hidden  •  1 ms total  •  10 calls total
                ►0.00%   get_EditorOperations  •  0 ms  •  2 calls  •  MonoDevelop.Ide.Editor.TextEditor.get_EditorOperations
               0.00%   get_Editor  •  0 ms  •  2 calls  •  MonoDevelop.Ide.Editor.Extension.TextEditorExtension.get_Editor
            ►2.90%   OnMoveBlockDown  •  3,189 ms  •  2 calls  •  MonoDevelop.Ide.Editor.Extension.DefaultCommandTextEditorExtension.OnMoveBlockDown
         0.00%   4 functions hidden  •  0 ms total  •  20 calls total
      ►0.01%   UpdateToolbars  •  12 ms  •  4 calls  •  MonoDevelop.Components.Commands.CommandManager.UpdateToolbars
       0.00%   32 functions hidden  •  1 ms total  •  676 calls total
     0.00%   21 functions hidden  •  1 ms total  •  104 calls total
   0.00%   2 functions hidden  •  0 ms total  •  10 calls total

VS bug #700292

@Therzok

This comment has been minimized.

@Therzok

This comment has been minimized.

Copy link
Member Author

commented Oct 16, 2018

@mkrueger mkrueger self-assigned this Oct 24, 2018

mkrueger added a commit that referenced this issue Oct 26, 2018
@mkrueger

This comment has been minimized.

Copy link
Contributor

commented Oct 26, 2018

IndentationService is too unreliable for this operation and probably a performance issue as well - requesting an indentation for each line extra is basically a bad idea.

(That's why we're slow here in the first place - we query that for each line extra.)

Therzok added a commit that referenced this issue Nov 2, 2018
Therzok added a commit that referenced this issue Nov 2, 2018
@xamarin-release-manager

This comment has been minimized.

Copy link
Contributor

commented Nov 2, 2018

Fixed in version 7.8.0.1104 (master)

Author: Mike Krüger
Commit: e253318 (mono/monodevelop)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.