This is a question of /fast/ vs. /light/ ;-)

I'd like to hear your comments about a feature of Domingo's proposed
patch for STR #2480. This patch allocates two arrays of positions and
sizes, resp., for Fl_Tabs' tabs (or riders) permanently. They are only
reallocated, if the number of children changed (this could perhaps be
optimized to do it only if the number is increased beyond the allocated
size).

First I thought that this is not very useful, because we allocate the
arrays only for the draw() method, but then I realized that we also
need it in Fl_Tabs::which(), and this is called in Fl_Tabs::handle()
for FL_MOVE events under certain conditions. The arrays are currently
malloc'd and free'd every time.

The additional widget sizes are about (8*children()+20) bytes that
would be permanently allocated. We could probably also reduce it if
we use only shorts for the array instead of int.

IMHO we can do this to gain speed and maybe reduce memory fragmen-
tation, especially since there are typically not so many Fl_Tabs
widgets in an application, and the number of children is somewhat
limited.

Any objections, thoughts, suggestions ?

If this is accepted, I'd like to apply my proposed patch, unless there
are other reasons or API suggestions.

http://www.fltk.org/str.php?L2480
http://www.fltk.org/strfiles/2480/client_area.diff

Albrecht
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to