I assume you have a _lot_ of text.
Not really. I start out with no text and then it gets longer as the chat log gets longer. The chat log is for an application in which every action in the application posts an entry to the chat log, so it gets long fast, but by the time the slow down starts it isn't that long. One part of the application has a list of things you can scroll through with a key bind, each item you pass on the list causes a chat entry, plays a sound and activates a graphic. If I just continuously do this within 20 or 30 seconds it become apparent that each item is taking longer and longer to do and playing its sound slower and slower because the chat log is adding an artificial delay. After maybe 60 seconds of this, the delay starts becoming apparent in other ways. For example, if you click an item 4 times that posts to the chat, the posts take time to process and happen visibility after you clicked.
And that you're not reading text from a file, but rather loading longer and longer strings, which loads slower and slower.
That is correct. It is a chat dialog, not a saved file.
Try speeding up the parser before doing anything else. Open the htmlcomp.lpk package (Package | Open) and in Options on the Other tab, delete the conditional -dDebugIt. Now rebuild Laz and test your app again. The package should now be compiled with range-checking, etc. turned off. If that speeds up things, then you could look at the code in readhtml.pas where the parsing takes place and see if there are other little changes here that could speed up parsing even more.
To make sure you've built without DebugIt, look at HtmlComp.compiled (text file) under package/units and make sure it doesn't show -dDebugIt.
I did all of this. I'm sure it sped things up but it didn't help the basic issue, which is that a larger and larger section of HTML is being reprocessed, when only the new entry to the list should be processed as HTML and the old parts should be left in their pre-processed states.
Note that when you move up to the real deal, WebView, it appears to have the kind of things you need - see the replaceSelectionWithMarkupString: method:
I mentioned this before. I can't ever move to WebView. My code needs to be cross-platform.
I'm going to go digging through the code of THTMLView now itself to see how hard it would be to code a new ApprendFromString procedure. If you have any further ideas or suggestions, feel free to let me know. Thanks!