Re: TreeView speedup
On Mon, 2003-03-24 at 11:41, Andrew E. Makeev wrote: Good day, I would to ask if someone got TreeView widget filling in speed really improved? On our side we made 2 improvements: 1. Added function in GTK that fills TreeModel row with values stored in GList. Test case: 1 rows with 4 string, 4 int, 4 double, 4 bool columns. Model was filled with values in 3-4 x times faster. (1 sec against 4 sec). 2. Wrote our own simple TextRenderer with cached Pango::Layout where only text could be changed. Test case: 1 rows with 4 string, 4 int, 4 double, 4 bool columns. TreeView was filled with values in 3-4 x times faster. (8-9 sec against 30 sec). Hi, Could you post code for these improvements? I just use CList, because of TreeView being so slow. But I would like to use TreeView, and it would be easier for me to write TextRenderer if I see something similar. Regards, Olaf Fraczyk ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
RE: TreeView speedup
Can't you just freeze and unfreeze the TreeView somehow when adding lots of rows? Murray Cumming [EMAIL PROTECTED] www.murrayc.com -Original Message- From: Olaf Fraczyk [mailto:[EMAIL PROTECTED] Sent: Freitag, 28. März 2003 10:49 To: Andrew E. Makeev Cc: gtkmm-main; GTK-MAIN Subject: Re: TreeView speedup On Mon, 2003-03-24 at 11:41, Andrew E. Makeev wrote: Good day, I would to ask if someone got TreeView widget filling in speed really improved? On our side we made 2 improvements: 1. Added function in GTK that fills TreeModel row with values stored in GList. Test case: 1 rows with 4 string, 4 int, 4 double, 4 bool columns. Model was filled with values in 3-4 x times faster. (1 sec against 4 sec). 2. Wrote our own simple TextRenderer with cached Pango::Layout where only text could be changed. Test case: 1 rows with 4 string, 4 int, 4 double, 4 bool columns. TreeView was filled with values in 3-4 x times faster. (8-9 sec against 30 sec). Hi, Could you post code for these improvements? I just use CList, because of TreeView being so slow. But I would like to use TreeView, and it would be easier for me to write TextRenderer if I see something similar. Regards, Olaf Fraczyk ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
RE: TreeView speedup
On Fri, 2003-03-28 at 12:04, [EMAIL PROTECTED] wrote: Can't you just freeze and unfreeze the TreeView somehow when adding lots of rows? Please take a look at speeding up GtkTreeView? thread on gtk-app-devel from 11 Feb 2003. There were also discussion about it last year, but I don't remember exactly when. The conclusion was that the only solution was to write custom GtkTreeModel. And that other source of slowness is pango. Regards, Olaf ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: TreeView speedup
On Mon, 2003-03-24 at 11:41, Andrew E. Makeev wrote: 2. Wrote our own simple TextRenderer with cached Pango::Layout where only text could be changed. Test case: 1 rows with 4 string, 4 int, 4 double, 4 bool columns. TreeView was filled with values in 3-4 x times faster. (8-9 sec against 30 sec). Hi, Could you post code for these improvements? I just use CList, because of TreeView being so slow. But I would like to use TreeView, and it would be easier for me to write TextRenderer if I see something similar. Well, here is test sample with simple text renderer (column size is not handled well though). -andrew #include gtkmm.h #include gtk/gtkliststore.h class CellRendererTextSimple : public Gtk::CellRenderer { public: CellRendererTextSimple (); virtual ~CellRendererTextSimple () { } Glib::PropertyProxyGlib::ustring property_text(); protected: virtual void get_size_vfunc (Gtk::Widget widget, const Gdk::Rectangle* cell_area, int* x_offset, int* y_offset, int* width, int* height); virtual void render_vfunc (const Glib::RefPtrGdk::Window window, Gtk::Widget widget, const Gdk::Rectangle background_area, const Gdk::Rectangle cell_area, const Gdk::Rectangle expose_area, Gtk::CellRendererState flags); private: Glib::PropertyGlib::ustring property_text_; Glib::RefPtr Pango::Layout m_ptrLayout; bool m_needLayout; }; CellRendererTextSimple::CellRendererTextSimple () : Glib::ObjectBase (typeid(CellRendererTextSimple)), Gtk::CellRenderer (), property_text_(*this, text, ), m_needLayout (true) { property_mode () = Gtk::CELL_RENDERER_MODE_INERT; property_xpad () = 2; property_ypad () = 2; property_xalign () = 0.0; property_yalign () = 0.5; } Glib::PropertyProxyGlib::ustring CellRendererTextSimple::property_text () { return property_text_.get_proxy(); } void CellRendererTextSimple::get_size_vfunc (Gtk::Widget widget, const Gdk::Rectangle* cell_area, int* x_offset, int* y_offset, int* width, int* height) { if (m_needLayout) { m_ptrLayout = widget.create_pango_layout (); m_needLayout = false; } Pango::Rectangle rect = m_ptrLayout-get_pixel_logical_extents (); if (width) { *width = property_xpad ()*2 + rect.get_width (); } if (height) { *height = property_ypad ()*2 + rect.get_height (); } if (cell_area) { if (x_offset) { *x_offset = int (property_xalign ()*(cell_area-get_width () - rect.get_width () - 2*property_xpad ())); *x_offset = std::max (*x_offset, 0); } if (y_offset) { *y_offset = int (property_yalign ()*(cell_area-get_height () - rect.get_height () - 2*property_ypad ())); *y_offset = std::max (*y_offset, 0); } } } void CellRendererTextSimple::render_vfunc (const Glib::RefPtrGdk::Window window, Gtk::Widget widget, const Gdk::Rectangle background_area, const Gdk::Rectangle cell_area, const Gdk::Rectangle expose_area, Gtk::CellRendererState flags) { if (m_needLayout) { m_ptrLayout = widget.create_pango_layout (); m_needLayout = false; } m_ptrLayout-set_text (property_text ()); const unsigned int cell_xpad = property_xpad (); const unsigned int cell_ypad = property_ypad (); Gtk::StateType state; int x_offset = 0, y_offset = 0, width = 0, height = 0; get_size (widget, cell_area, x_offset, y_offset, width, height); if((flags Gtk::CELL_RENDERER_SELECTED) != 0) { state = (widget.has_focus()) ? Gtk::STATE_SELECTED : Gtk::STATE_ACTIVE; } else { state = (widget.is_sensitive()) ? Gtk::STATE_NORMAL : Gtk::STATE_INSENSITIVE; } widget.get_style () -paint_layout (window, state, true, cell_area, widget, cellrenderertext, cell_area.get_x () + x_offset + cell_xpad, cell_area.get_y () + y_offset + cell_ypad, m_ptrLayout); } class MyWindow : public Gtk::Window { struct MyColumnModel : Gtk::TreeModel::ColumnRecord { Gtk::TreeModelColumn int id; Gtk::TreeModelColumn Glib::ustring label; Gtk::TreeModelColumn double val;
TreeView speedup
Good day, I would to ask if someone got TreeView widget filling in speed really improved? On our side we made 2 improvements: 1. Added function in GTK that fills TreeModel row with values stored in GList. Test case: 1 rows with 4 string, 4 int, 4 double, 4 bool columns. Model was filled with values in 3-4 x times faster. (1 sec against 4 sec). 2. Wrote our own simple TextRenderer with cached Pango::Layout where only text could be changed. Test case: 1 rows with 4 string, 4 int, 4 double, 4 bool columns. TreeView was filled with values in 3-4 x times faster. (8-9 sec against 30 sec). Any other suggestions would be welcome. Machine: 1.2GHz Duron, 256Mb DDR PC2100, MB MS KT256, HDD 40Gb 5000rpm, Video ATI Radeon 32Mb. Regards, -andrew ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: TreeView speedup
* Andrew E. Makeev ([EMAIL PROTECTED]) wrote: Good day, I would to ask if someone got TreeView widget filling in speed really improved? On our side we made 2 improvements: 1. Added function in GTK that fills TreeModel row with values stored in GList. Test case: 1 rows with 4 string, 4 int, 4 double, 4 bool columns. Model was filled with values in 3-4 x times faster. (1 sec against 4 sec). 2. Wrote our own simple TextRenderer with cached Pango::Layout where only text could be changed. Test case: 1 rows with 4 string, 4 int, 4 double, 4 bool columns. TreeView was filled with values in 3-4 x times faster. (8-9 sec against 30 sec). Any other suggestions would be welcome. I'm just learning the widget myself so I don't have any suggestions for you. But I am interested in your findings if you care to share them with the rest of us ;-) I'm using several TreeViews in my application for displaying of status and database information. -- .''`. Carl B. Constantine : :' : [EMAIL PROTECTED] `. `'GnuPG: 135F FC30 7A02 B0EB 61DB 34E3 3AF1 DC6C 9F7A 3FF8 `- Debian GNU/Linux -- The power of freedom pgp0.pgp Description: PGP signature