Re: GTK+ performance problem

On Wed, 2006-09-13 at 07:41 -0700, mikecorn wrote:
> 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

The problem isn't, I think, that creating marks is slow for large
buffers, it's that having thousands and thousands of marks for the same
buffer is slow...

Why did you think that your original implementation wasn't a problem?
Sounds like some documentation somewhere needs to be fixed.


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