Is there anything I can do to improve the performance when I repeatedly execute a keyboard macro?
I frequently use macros to perform repetative tasks - maybe executing the macro 100 times (or more) by calling
SelectedView.RaiseEditCommand(macro)
within a loop. (My app allows the user to specify how many times the macro - or any keystroke - will be executed.)
I have a simple macro that just does the following
Press 'Delete' 8 times
Go to the end of the line
Press 'Backspace' 10 times
Press Space
Press Delete
I use this to convert sections of the language definition files from my old Editor component into the format required by your component. Since there may be hundreds of tokens in each section of the file I generally need to execute it 40 to 400 times.
Using the old editor to do this I can execute the macro 100 times in 2.5 seconds.
Using your editor the numbers vary widely - but are always bad - 14 to 46 seconds.
This is AFTER I added code to do the following:
SuspendPainting()
Document.LexicalParsingEnabled = False
In fact adding the above did not seem to make much of a difference.
Note that I also suspend the UndoRedo buffer [Document.UndoRedo.StartGroup()] so that a user can undo all the changes with one click. Undo appears to take slightly longer than the original application of the changes. [19 to 50 seconds]
Is there any way to speed up repetitive executions of a macro?
Maybe some kind of 'compile' like option?
I can avoid the problem myself by simply using my older app, but that's not something I can suggest to my customers once we release the new version of our app that uses your Editor control instead of CodeMax.
Thanks
Mike