Re: [PySide] model/view: faster to access a user role than accessing a dict?

2022-10-06 Thread Frank Rueter
Cool, thanks for the reassurance. I will focus on readability.

Cheers,
frank

On Tue, Oct 4, 2022 at 2:36 PM Tim Roberts  wrote:

> On 10/3/22 12:19, Frank Rueter wrote:
>
> > I wasn't talking about the time it takes to put data into the
> > model but the reactiveness of the resulting view when lots of data is
> > present and the user needs to traverse the tree view and filter it as
> > quickly as possible.
>
> OK, but remember that nothing gets drawn until your handler returns and
> you get to the main loop to dispatch messages.  The computation time
> between those two approaches will be essentially identical, so the user
> experience should be the same.
>
> --
>
> Tim Roberts, t...@probo.com
> Providenza & Boekelheide, Inc.
>
> ___
> PySide mailing list
> PySide@qt-project.org
> https://lists.qt-project.org/listinfo/pyside
>
___
PySide mailing list
PySide@qt-project.org
https://lists.qt-project.org/listinfo/pyside


Re: [PySide] model/view: faster to access a user role than accessing a dict?

2022-10-03 Thread Tim Roberts

On 10/3/22 12:19, Frank Rueter wrote:

I wasn't talking about the time it takes to put data into the 
model but the reactiveness of the resulting view when lots of data is 
present and the user needs to traverse the tree view and filter it as 
quickly as possible.


OK, but remember that nothing gets drawn until your handler returns and 
you get to the main loop to dispatch messages.  The computation time 
between those two approaches will be essentially identical, so the user 
experience should be the same.


--

Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.

___
PySide mailing list
PySide@qt-project.org
https://lists.qt-project.org/listinfo/pyside


Re: [PySide] model/view: faster to access a user role than accessing a dict?

2022-10-03 Thread Tim Roberts

Frank Rueter wrote:


I am building a model for a tree view and have a dictionary that 
represents all the data in the required hierarchy.
I have to be able to filter the view, select things programmatically 
and show info based on selected items etc.

I am wondering:
With all required data per item available in a dict, is it more 
efficient to just stuff that into the item's UserRole data or to 
create custom user roles for each value in the dict that I will be 
filtering/sorting by or looking up for some other reason?

E.g.:
Will there be a difference in performance with this:


Let's be honest.  This is code that gets execute once. Performance is 
not a consideration.  Do whatever makes the code simpler.


It's almost never smart to spend time optimizing your initialization.

--
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.



smime.p7s
Description: S/MIME Cryptographic Signature
___
PySide mailing list
PySide@qt-project.org
https://lists.qt-project.org/listinfo/pyside