gabesoft / evil-mc

Multiple cursors implementation for evil-mode
MIT License
383 stars 35 forks source link

Really rough performance sometimes and a suggestion #77

Open quicknir opened 6 years ago

quicknir commented 6 years ago

Some major modes that have really intensive hooks can cause performance in evil-mc to get really rough. For instance, cc-mode has some pretty aggressive things in before-change-functions, and after-change-functions. When you create 10 cursors, each time you press a key, every function in both of these lists is executed 10 times. As well, post-self-insert-hook is yet another example of this (it all adds up).

You can actually inhibit the first two hooks by setting inhibit-modification-hooks. The last could also be inhibited simply by doing a (let ((post-self-insert-hook nil)) ...). I assume that evil-mc somewhere simply implements a loop over all the cursors, passing the input to all of them. Surpressing all these hooks during that loop, and simply calling them each once, would make them executed far less and vastly improve performance.

gabesoft commented 6 years ago

Thanks for the suggestion. I'll look into inhibiting some of the hooks when I get a chance