GTK+ performance problem



I had a performance problem and found a work-around. 
I think the GTK gurus should know about this.

Scrolling output of text from a text view window got slower and slower as
the 
amount of text in the buffer increased.

Here is what I was doing after adding each line of text at the end of the
buffer:

      gtk_text_buffer_get_end_iter(textBuff,&iter1);
      endMark = gtk_text_buffer_create_mark(textBuff,null,&iter1,0);
      gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(textWin),endMark,0,0,1,1);

After a few thousand lines, the output speed was a tiny fraction of the
initial speed. 

I found an easy solution: save the endMark and avoid the call to
gtk_text_buffer_create_mark(...). 
Apparently this function is very slow if the text in the buffer is large
(like > 100 KB).
(Is there a good reason for this?).

After this change, the output speed remains very fast (1000s of lines per
second), 
even if the buffer has megabytes of  text.

My GTK+ version is 2.8.20

-- 
View this message in context: http://www.nabble.com/GTK%2B-performance-problem-tf2265649.html#a6286930
Sent from the Gtk+ - Dev - General forum at Nabble.com.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]