Among other challenges in bringing an older app up to cocoa and the latest xojo version has been a very simple log window. Under carbon this was no problem. The window stores around 30k of styled text. With each added line I check the length of the entire field and then delete some off the top as I add another line onto the bottom. I did the adding and deleting by moving the insertion point and setting the seltext, either to the new line, or to an empty string in order to remove old entries off the top. I wasnt resetting the entire 30k each time.
The app used a huge amount more CPU after moving to carbon and I narrowed it down to rendering that log window. I understand that the textField is now a much more capable control than it used to be and I turned off as much of that as I could like spell checking but it made no difference. Then I dived into the MBS plugins and turned off ALL the options that there were flags for there, all the special kerning and ligatures and grammar checking and everything else. No difference.
If I logged too many lines in a second the entire app would spin the beach ball and refuse all other input.
I replaced the entire thing with a listbox that just adds colored lines of text or pops them off the top and the difference is amazing. The listbox stores 2000 lines which is far more than the old field ever could hold. using a textField storing 30k of text my app averaged 70% of the CPU with elongated spikes over 90% (this is a 2 year old mini) with the listbox managing it the CPU usage is 10% with spikes as high as 15%.
I cant believe that no matter what its trying to do with text encoding and rendering a bazillion characters that it should be that difficult. What is going on with the TextField?