[PyQt] Performance of QTreeView
    Knacktus 
    knacktus at googlemail.com
       
    Sun Oct 10 12:50:39 BST 2010
    
    
  
Am 10.10.2010 13:01, schrieb Virgil Dupras:
> It probably has something to do with the bazillions of parent() call
> that are made to your model. I asked a similar question on stack
> overflow a while ago. I profiled the example, so the bottleneck is
> evident.
>
> http://stackoverflow.com/questions/841096/slow-selection-in-qtreeview-why
>
> So the answer is: In some respects, Qt sucks balls.
>
> Regards,
> --
> Virgil Dupras
> Hardcoded Software
> http://www.hardcoded.net
Thanks for your reply. I've used your profiling instructions (never done 
that before, so another thing learned;-)) and now I'm puzzled...
In my example with just 500 Items(!!) Qt calls some of the model methods 
125000 times for one "expandAll()" call!!!!
What!?!?
Does anyone know something about that?
Here's the profiling data:
Sun Oct 10 13:23:55 2010    profdata
          896930 function calls in 8.202 CPU seconds
    Ordered by: internal time
    ncalls  tottime  percall  cumtime  percall filename:lineno(function)
         1    5.885    5.885    8.202    8.202 {built-in method exec_}
    125853    1.238    0.000    1.943    0.000 
C:\Users\Jan\Desktop\Integrations-System\Source\ipdm\QTreeView_Performance.py:220(parent)
         1    0.336    0.336    2.301    2.301 {built-in method expandAll}
    128294    0.239    0.000    0.300    0.000 
C:\Users\Jan\Desktop\Integrations-System\Source\ipdm\QTreeView_Performance.py:235(view_item_from_index)
    127372    0.212    0.000    0.217    0.000 
C:\Users\Jan\Desktop\Integrations-System\Source\ipdm\QTreeView_Performance.py:53(children)
    125734    0.179    0.000    0.179    0.000 {built-in method createIndex}
    128294    0.040    0.000    0.040    0.000 {built-in method isValid}
    125045    0.028    0.000    0.028    0.000 {method 'index' of 'list' 
objects}
    128168    0.020    0.000    0.020    0.000 {built-in method 
internalPointer}
      1638    0.008    0.000    0.023    0.000 
C:\Users\Jan\Desktop\Integrations-System\Source\ipdm\QTreeView_Performance.py:180(rowCount)
       689    0.004    0.000    0.008    0.000 
C:\Users\Jan\Desktop\Integrations-System\Source\ipdm\QTreeView_Performance.py:215(index)
       801    0.003    0.000    0.004    0.000 
C:\Users\Jan\Desktop\Integrations-System\Source\ipdm\QTreeView_Performance.py:195(data)
       500    0.002    0.000    0.005    0.000 
C:\Users\Jan\Desktop\Integrations-System\Source\ipdm\QTreeView_Performance.py:80(get_view_item_children)
       499    0.002    0.000    0.002    0.000 
C:\Users\Jan\Desktop\Integrations-System\Source\ipdm\QTreeView_Performance.py:46(__init__)
      1018    0.002    0.000    0.002    0.000 
C:\Users\Jan\Desktop\Integrations-System\Source\ipdm\QTreeView_Performance.py:192(columnCount)
       114    0.001    0.000    0.001    0.000 
C:\Users\Jan\Desktop\Integrations-System\Source\ipdm\QTreeView_Performance.py:208(headerData)
      2678    0.000    0.000    0.000    0.000 {len}
         1    0.000    0.000    2.301    2.301 
C:\Users\Jan\Desktop\Integrations-System\Source\ipdm\QTreeView_Performance.py:141(expand_all)
       114    0.000    0.000    0.000    0.000 {built-in method column}
       114    0.000    0.000    0.000    0.000 {getattr}
         1    0.000    0.000    8.202    8.202 <string>:1(<module>)
         1    0.000    0.000    0.000    0.000 {method 'disable' of 
'_lsprof.Profiler' objects}
    
    
More information about the PyQt
mailing list