Re: Gtk::Text widget



Derek Simkowiak <dereks@kd-dev.com> writes: 
> 	The big one is Havoc's new text widget, originally based on the
> TkText widget.  It is very featureful, and Owen added Pango support, but
> it is a huge memory hog (just like the TkText widget).
>

I think "memory hog" is an overstatement; last time I measured it the
overhead without tags was less than 3 bytes per character, including
all memory used by the GTK process (i.e. including the GTK runtime
unrelated to the widget). Using lots and lots of tags could double
your memory usage, but probably not much worse than that.

You get an important benefit from the memory overhead, which is that
there are few if any truly slow operations on this widget. Almost
every operation is faster than you expect it to be; frequently O(log
n) replaces the O(n) of a standard gapped text buffer. This means you
can simply use the API, with no performance surprises. Even if you
change the size of every character in the buffer, which requires a
relayout of the whole buffer to compute the scrollbars, the GUI will
not lock up because the widget can do incremental reflow starting
with the currently visible area.
 
Anyway, the full story IMHO is that yes the widget uses more memory
than it has to for simple buffers, but in exchange you get a robust,
scaleable widget. Also of course, the API is quite high-level and
featureful, including tags, marks, etc.

Havoc





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