#9870: msw.wxListCtrl.FindItem(int) so slow

View: New views
11 Messages — Rating Filter:   Alert me  

#9870: msw.wxListCtrl.FindItem(int) so slow

by wxTrac :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ticket URL: <http://trac.wxwidgets.org/ticket/9870>

#9870: msw.wxListCtrl.FindItem(int) so slow
--------------------------------+-------------------------------------------
 Reporter:  Jes                 |       Owner:  JS    
     Type:  optimization        |      Status:  new    
 Priority:  normal              |   Milestone:        
Component:  wxMSW               |     Version:  2.9-svn
 Keywords:  findstr wxlistctrl  |   Blockedby:        
    Patch:  0                   |    Blocking:        
--------------------------------+-------------------------------------------
 List control use builtin data storage for storing own internal class.
 When often using finditem it retrieve data from all list controls items,
 if it more than hundred or more - process so slow.
 Maybe add wxHashMap for optimization as this
 hashmap<LPARAM,wxListItemInternalData* >
 than finditem will get an index of list control without any?
 I think another optimization without library code changes not possible.

 I'll try to do patch

 PS: using profiler for my project finditem consume 50% of working time


--
Ticket URL: <http://trac.wxwidgets.org/ticket/9870>
_______________________________________________
wx-dev mailing list
wx-dev@...
http://lists.wxwidgets.org/mailman/listinfo/wx-dev

Re: #9870: msw.wxListCtrl.FindItem(int) so slow

by wxTrac :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ticket URL: <http://trac.wxwidgets.org/ticket/9870#comment:1>

#9870: msw.wxListCtrl.FindItem(int) so slow
---------------------------+------------------------------------------------
  Reporter:  Jes           |       Owner:  JS                
      Type:  optimization  |      Status:  new              
  Priority:  normal        |   Milestone:                    
 Component:  wxMSW         |     Version:  2.9-svn          
Resolution:                |    Keywords:  findstr wxlistctrl
 Blockedby:                |       Patch:  1                
  Blocking:                |  
---------------------------+------------------------------------------------
Changes (by Jes):

  * patch:  0 => 1


Comment:

 attached patch
 in brief:
 add wxArray that content all LPARAMs of wxListCtrl
 and attach it for adding and removing of wxListItemInternalData
 rebuild FindItem(int,int) based on wxArray


--
Ticket URL: <http://trac.wxwidgets.org/ticket/9870#comment:1>
_______________________________________________
wx-dev mailing list
wx-dev@...
http://lists.wxwidgets.org/mailman/listinfo/wx-dev

Re: #9870: msw.wxListCtrl.FindItem(int) so slow

by wxTrac :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ticket URL: <http://trac.wxwidgets.org/ticket/9870#comment:2>

#9870: msw.wxListCtrl.FindItem(int) so slow
---------------------------+------------------------------------------------
  Reporter:  Jes           |       Owner:  JS                
      Type:  optimization  |      Status:  new              
  Priority:  normal        |   Milestone:                    
 Component:  wxMSW         |     Version:  2.9-svn          
Resolution:                |    Keywords:  findstr wxlistctrl
 Blockedby:                |       Patch:  1                
  Blocking:                |  
---------------------------+------------------------------------------------

Comment(by oneeyeman):

 Hi,
 Are you using regular or virtual list control?

 Thank you.


--
Ticket URL: <http://trac.wxwidgets.org/ticket/9870#comment:2>
_______________________________________________
wx-dev mailing list
wx-dev@...
http://lists.wxwidgets.org/mailman/listinfo/wx-dev

Re: #9870: msw.wxListCtrl.FindItem(int) so slow

by wxTrac :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ticket URL: <http://trac.wxwidgets.org/ticket/9870#comment:3>

#9870: msw.wxListCtrl.FindItem(int) so slow
---------------------------+------------------------------------------------
  Reporter:  Jes           |       Owner:  JS                
      Type:  optimization  |      Status:  new              
  Priority:  normal        |   Milestone:                    
 Component:  wxMSW         |     Version:  2.9-svn          
Resolution:                |    Keywords:  findstr wxlistctrl
 Blockedby:                |       Patch:  1                
  Blocking:                |  
---------------------------+------------------------------------------------

Comment(by Jes):

 regular with report and icon views


--
Ticket URL: <http://trac.wxwidgets.org/ticket/9870#comment:3>
_______________________________________________
wx-dev mailing list
wx-dev@...
http://lists.wxwidgets.org/mailman/listinfo/wx-dev

Re: #9870: msw.wxListCtrl.FindItem(int) so slow

by wxTrac :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ticket URL: <http://trac.wxwidgets.org/ticket/9870#comment:4>

#9870: msw.wxListCtrl.FindItem(int) so slow
---------------------------+------------------------------------------------
  Reporter:  Jes           |       Owner:  JS                
      Type:  optimization  |      Status:  new              
  Priority:  normal        |   Milestone:                    
 Component:  wxMSW         |     Version:  2.9-svn          
Resolution:                |    Keywords:  findstr wxlistctrl
 Blockedby:                |       Patch:  1                
  Blocking:                |  
---------------------------+------------------------------------------------

Comment(by oneeyeman):

 Take a look at the virtual list control. It is created just to manage a
 big number of items.

 If this one will be slow, then come back here...

 Thank you.


--
Ticket URL: <http://trac.wxwidgets.org/ticket/9870#comment:4>
_______________________________________________
wx-dev mailing list
wx-dev@...
http://lists.wxwidgets.org/mailman/listinfo/wx-dev

Re: #9870: msw.wxListCtrl.FindItem(int) so slow

by wxTrac :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ticket URL: <http://trac.wxwidgets.org/ticket/9870#comment:5>

#9870: msw.wxListCtrl.FindItem(int) so slow
---------------------------+------------------------------------------------
  Reporter:  Jes           |       Owner:  JS                
      Type:  optimization  |      Status:  new              
  Priority:  normal        |   Milestone:                    
 Component:  wxMSW         |     Version:  2.9-svn          
Resolution:                |    Keywords:  findstr wxlistctrl
 Blockedby:                |       Patch:  1                
  Blocking:                |  
---------------------------+------------------------------------------------

Comment(by Jes):

 I need list control with report or big icons and more than hundred items
 in my project
 but virtual  list control can manage report view only ;)


--
Ticket URL: <http://trac.wxwidgets.org/ticket/9870#comment:5>
_______________________________________________
wx-dev mailing list
wx-dev@...
http://lists.wxwidgets.org/mailman/listinfo/wx-dev

Re: #9870: msw.wxListCtrl.FindItem(int) so slow

by wxTrac :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ticket URL: <http://trac.wxwidgets.org/ticket/9870#comment:6>

#9870: msw.wxListCtrl.FindItem(int) so slow
---------------------------+------------------------------------------------
  Reporter:  Jes           |       Owner:  JS                
      Type:  optimization  |      Status:  infoneeded_new    
  Priority:  normal        |   Milestone:                    
 Component:  wxMSW         |     Version:  2.9-svn          
Resolution:                |    Keywords:  findstr wxlistctrl
 Blockedby:                |       Patch:  1                
  Blocking:                |  
---------------------------+------------------------------------------------
Changes (by vadz):

  * status:  new => infoneeded_new


Comment:

 I agree that we have a problem here but if we're going to solve it by
 storing the data internally why not simply store the user data internally
 too?

 I also wonder how does the patch actually work: it doesn't seem to update
 the indices of this internal array anywhere but it's clear that this needs
 to be done or they get out of sync when items are inserted/deleted.

 There are also style issues (like not using Windows LPARAM in a public
 header, naming member variables using m_ prefix and starting with lower
 case letter, using more braces and less casts, ...) so this patch can't be
 applied as is anyhow but, once again, I have doubts about whether this
 approach is the right one at all. At the very least, if we must keep
 mapping between indices and client data ourselves it becomes useless to
 also store it in wxListCtrl.


--
Ticket URL: <http://trac.wxwidgets.org/ticket/9870#comment:6>
_______________________________________________
wx-dev mailing list
wx-dev@...
http://lists.wxwidgets.org/mailman/listinfo/wx-dev

Re: #9870: msw.wxListCtrl.FindItem(int) so slow

by wxTrac :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ticket URL: <http://trac.wxwidgets.org/ticket/9870#comment:7>

#9870: msw.wxListCtrl.FindItem(int) so slow
---------------------------+------------------------------------------------
  Reporter:  Jes           |       Owner:                    
      Type:  optimization  |      Status:  new              
  Priority:  normal        |   Milestone:                    
 Component:  wxMSW         |     Version:  2.9-svn          
Resolution:                |    Keywords:  findstr wxlistctrl
 Blockedby:                |       Patch:  1                
  Blocking:                |  
---------------------------+------------------------------------------------
Changes (by Jes):

  * owner:  JS =>
  * status:  infoneeded_new => new


Comment:

 >>I agree that we have a problem here but if we're going to solve it by
 storing the data internally why not simply store the user data internally
 too?
 If user data will be stored internally
 How I can find this item in wxListCtrl????
 Only retrieve all items of controll and compare with user data??

 >>I also wonder how does the patch actually work: it doesn't seem to
 update the indices of this internal array anywhere but it's clear that
 this needs to be done or they get out of sync when items are
 inserted/deleted.
 patch only collect LPARAMs(private) of wxListItemInternalData items of
 single wxListCtrl
 and use for mapping with LPARAMs(public) of user

 >>There are also style issues (like not using Windows LPARAM in a public
 >>header, naming member variables using m_ prefix and starting with lower
 case letter, using more braces and less casts, ...) so this patch can't be
 applied as is anyhow but, once again, I have doubts about whether this
 approach is the right one at all. At the very least, if we must keep
 mapping between indices and client data ourselves it becomes useless to
 also store it in wxListCtrl.
 but this patch can be used as base for future patches :)

 and why U use wxXXXInternalData functions as static??
 maybe merge this to standalone class and add mapping array for fast
 searching?


--
Ticket URL: <http://trac.wxwidgets.org/ticket/9870#comment:7>
_______________________________________________
wx-dev mailing list
wx-dev@...
http://lists.wxwidgets.org/mailman/listinfo/wx-dev

Re: #9870: msw.wxListCtrl.FindItem(int) so slow

by wxTrac :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ticket URL: <http://trac.wxwidgets.org/ticket/9870#comment:8>

#9870: msw.wxListCtrl.FindItem(int) so slow
---------------------------+------------------------------------------------
  Reporter:  Jes           |       Owner:                    
      Type:  optimization  |      Status:  new              
  Priority:  normal        |   Milestone:                    
 Component:  wxMSW         |     Version:  2.9-svn          
Resolution:                |    Keywords:  findstr wxlistctrl
 Blockedby:                |       Patch:  1                
  Blocking:                |  
---------------------------+------------------------------------------------

Comment(by vadz):

 Sorry, I am not sure I understand your reply: do you mean that your patch
 works correctly even when the items are inserted into/deleted from the
 control? I don't see how is it possible but I might be missing
 something...


--
Ticket URL: <http://trac.wxwidgets.org/ticket/9870#comment:8>
_______________________________________________
wx-dev mailing list
wx-dev@...
http://lists.wxwidgets.org/mailman/listinfo/wx-dev

Re: #9870: msw.wxListCtrl.FindItem(int) so slow

by wxTrac :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ticket URL: <http://trac.wxwidgets.org/ticket/9870#comment:9>

#9870: msw.wxListCtrl.FindItem(int) so slow
---------------------------+------------------------------------------------
  Reporter:  Jes           |       Owner:                    
      Type:  optimization  |      Status:  new              
  Priority:  normal        |   Milestone:                    
 Component:  wxMSW         |     Version:  2.9-svn          
Resolution:                |    Keywords:  findstr wxlistctrl
 Blockedby:                |       Patch:  1                
  Blocking:                |  
---------------------------+------------------------------------------------

Comment(by Jes):

 Yes of course and working in my project fast and w/o memleaks
 It binded to wxInternalData fully,but not to insert into/delete functions


--
Ticket URL: <http://trac.wxwidgets.org/ticket/9870#comment:9>
_______________________________________________
wx-dev mailing list
wx-dev@...
http://lists.wxwidgets.org/mailman/listinfo/wx-dev

Re: #9870: msw.wxListCtrl.FindItem(int) so slow

by wxTrac :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ticket URL: <http://trac.wxwidgets.org/ticket/9870#comment:10>

#9870: msw.wxListCtrl.FindItem(int) so slow
---------------------------+------------------------------------------------
  Reporter:  Jes           |       Owner:                    
      Type:  optimization  |      Status:  new              
  Priority:  normal        |   Milestone:                    
 Component:  wxMSW         |     Version:  2.9-svn          
Resolution:                |    Keywords:  findstr wxlistctrl
 Blockedby:                |       Patch:  1                
  Blocking:                |  
---------------------------+------------------------------------------------

Comment(by Jes):

 add more styled patch to wx


--
Ticket URL: <http://trac.wxwidgets.org/ticket/9870#comment:10>
_______________________________________________
wx-dev mailing list
wx-dev@...
http://lists.wxwidgets.org/mailman/listinfo/wx-dev
LightInTheBox - Buy quality products at wholesale price!