I'm using IWebBrowser2 to highlight various words in a page (in a C++ app). Using IHTMLTxtRange I select my text by doing this:
Range->moveStart (byChar, nFirstChar, &nActualCount);
Range->moveEnd (byChar, nLenToHighlight, &nActualCount);
It works fine in that my text is highlighted, but it's agonizingly slow. I just ran it through a profiler and the moveToElementText, collapse, and moveEnd were all very fast (a few tenths of a second for 200+ hits in a debug build). MoveStart, however, took 36 seconds for the same 200 hits. So, roughly 100 times slower.
Later in the code we highlight that range using IMarkupServices and IDisplayPointer and IHTMLRenderStyle all of that is very fast (total time for 30-ish lines of COM code for those 200 hits is about .15 seconds).
What in the world makes the call to moveStart so agonizingly slow? Any suggestions for other ways to insert highlights that will be fast?