Recently I was struggling with slowness of vim while scrolling. I ran into this stackoverflow comment that explains how to debug in Python:
:profile start profile.log
:profile func \*
:profile file \*
" At this point do slow actions
:profile pause
:noautocmd qall!
I’ve found out it slow downs mostly function Highlight_Match_Paren() and the fix can be found here But that is another story.