performance - Optimize pygtk/gtk TreeView interactive-search in a sorted column? -
performance - Optimize pygtk/gtk TreeView interactive-search in a sorted column? -
i have gtk.treeview custom model (inheriting gtk.treemodel) , show ~150k rows. i'm using pygtk, should not matter much.
the gui interaction ok, when activating interactive-search, takes forever (~10sec per char). understood searching liststore , tested, interactive-search checks each row of liststore (internally stored linked-list) find value.
since searching sorted column, want binary search.
how can ? need re-program interactive-search scratch ? can treemodelsort useful ? (i not how internals managed)
if roll own search ui, i'm not sure how start. sketch looks :
disable built-in interactive search create search ui, , connect right keypress manually binary search in custom representation of info (or in sorted shown rows if random access possible) select right match.for 3. seems gtktreemodel have random access rows:
a gtk.treemodel object supports of python mapping protocol allows retrieve gtk.treemodelrow object representing row in model.
is , efficiently random access ?
it unclear how implementing custom gtk.treemodel
- liststore
, or roll on own? 150k rows, not clear searching list store take 10 seconds.
it possible implement binary search on liststore
, search implemented treeview
not binary, scans list current position end, looking match. allows customizing "equals" callback, not search strategy. need more general search function accepts key , returns corresponding position in tree.
to implement efficient searching of big trees, need roll own search ui, along lines of outlined in edit question. looking @ existing implementation, not much work: boils downwards showing top-level gtk.window_popup
window contains entry activate
signal connected code search , positions tree cursor row found.
performance search treeview gtk pygtk
Comments
Post a Comment