Re: Begin/end sentence very slow with Word
I've noticed that the begin "(" and end ")" sentence features in the Word version are very slow. It takes between 3 and 3.5 seconds each time I use it. Any ideas why this is so?
You are not logged in. Please login or register.
I've noticed that the begin "(" and end ")" sentence features in the Word version are very slow. It takes between 3 and 3.5 seconds each time I use it. Any ideas why this is so?
By the way, I am using ViEmu version 1.0.19 on Windows XP Pro with Microsoft Word 2003 SP2.
Hi Brent,
Yes, you're right. Not machine specific, also happens with mine. Accessing the Word object model is incredibly slow, and ViEmu gets around that most of the time by caching information - but it seems the current caching mechanism doesn't help much with that motion. I will have a look at it and see if something can be done, although it might well be close to impossible. Word is really a lemon to work with. The same vi core that is really fast under Visual Studio or SQL Server often has performance problems with Word.
I'll let you know if I can improve it somehow.
Best regards and thanks,
Jon
Thanks a lot for looking into this Jon. I appreciate it.
Forgive me for this overly simplified suggestion but I have an idea that might be an adequate hack. Perhaps you could override the Word version of the begin/end sentence motion and simulate it with the code for the following command: "f.w" (forward to period and move to next word). I figured that this might work as I end up using this myself to simulate the motion because it's much faster. Just a thought.
Thanks for the quick response and all of the terrific work Jon! Keep it up!
Thanks a lot for the suggestion Brent. Yes, that might help, although the sentence motions' logic is a bit more convoluted. It recognizes other stuff, etc... In any case, I'll have a look at this, as it shouldn't be that much slower than a regular f..
Thanks for the kind comment,
Jon
Hi Brent,
I've determined the source of the slow down. As per vi/vim, the '(' and ')' motions save the current position in the position-history buffer (the one used by Ctrl-I/Ctrl-O to go back and forth). It's this operation which is slow, it's worse at the end of large-ish files. If that's not bad enough, it also becomes slower over time, because the logic that saves the position needs to compare the position against the previously stored ones, to determine whether it's in the same line as a previous one - in this case, that entry is brought to the top of the stack, instead of insesrting a new one (required to work the same as vim).
Incredible as it may sound, determining which line a position lies in is incredibly slow with the Word object model. It takes about 3.5ms in a simple 10-page document I've been testing in. It doesn't sound like much, but if you have to compare with 10 positions, that's 35ms, which starts to be noticeable. In the end, it can easily be in the 100s of ms, which causes the sluggishfeeling.
I will try to come up with a quicker way to do the line comparison and let you know what it results in. I'm currently finishing my next product ('Codekana for Visual Studio'), hopefully to be released in 2-3 weeks, and after taking some rest, I'll be able to have a look at quite a few pending ViEmu issues.
Regards,
Jon
Hi Brent,
It's this operation which is slow, it's worse at the end of large-ish files.
That makes sense. In my case I was editing an 11 page document when I noticed the problem.
I will try to come up with a quicker way to do the line comparison and let you know what it results in. I'm currently finishing my next product ('Codekana for Visual Studio'), hopefully to be released in 2-3 weeks, and after taking some rest, I'll be able to have a look at quite a few pending ViEmu issues.
It will be a huge help. Thanks a ton Jon!
Thanks Brent. For anyone else interested, we followed up by email and reached the conclusion that using the following mappings in _viemuwrc could be of some help:
nnoremap ( F.
nnoremap ) f.
Currently installed 3 official extensions. Copyright © 2003–2009 PunBB.
[ Generated in 0.030 seconds, 12 queries executed ]