TreeView performance question



One of my widgets has a treeview (using a ListStore) which needs to
get completely rebuilt based on some user event. I was doing some
profiling on the code and realised that a lot of time is being spent
in the Gtk2::ListStore::clear call.

I wrote a stripped down version of the code (attached) which purely
clears the model and rebuilds the model based on two button clicks.
Here is the profiler output on that script. (after a few clear and
re-populate calls)

# ------------------------------------ #
Total Elapsed Time = 13.69850 Seconds
  User+System Time = 6.208508 Seconds
Exclusive Times
%Time ExclSec CumulS #Calls sec/call Csec/c  Name
 54.2   3.366  6.360      1   3.3660 6.3597  Gtk2::main
 23.2   1.441  1.441      4   0.3602 0.3602  Gtk2::ListStore::clear
 17.0   1.061  1.061  50000   0.0000 0.0000  Gtk2::ListStore::set
 13.5   0.843  0.843  50000   0.0000 0.0000  Gtk2::ListStore::append
 1.29   0.080  0.080      1   0.0800 0.0800  Gtk2::Widget::show_all
 0.48   0.030  0.030      3   0.0100 0.0100  DynaLoader::dl_load_file
 0.48   0.030  0.119      6   0.0050 0.0198  main::BEGIN
 0.32   0.020  0.020      1   0.0200 0.0200  Gtk2::TreeView::new_with_model
 0.32   0.020  0.020      1   0.0200 0.0200  Gtk2::bootstrap
 0.16   0.010  0.010      1   0.0100 0.0100  Gtk2::init
 0.16   0.010  0.010      1   0.0100 0.0100  Gtk2::TreeView::insert_column_with
                                             _attributes
 0.16   0.010  0.010      1   0.0100 0.0100  Gtk2::ScrolledWindow::new
 0.16   0.010  0.010      3   0.0033 0.0033  overload::OVERLOAD
 0.16   0.010  0.010      1   0.0100 0.0100  XSLoader::load
 0.16   0.010  0.029      4   0.0025 0.0074  Gtk2::BEGIN
# ------------------------------------ #

Is there a way that I can speed up the clearing step ? 

Any other tips on speeding up the script will be appreciated too.

Ofey.

Attachment: tree.pl
Description: Binary data



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