[Kbabel] kbabeldict bottleneck

Stanislav Visnovsky visnovsky@nenya.ms.mff.cuni.cz
Mon, 3 Mar 2003 13:20:56 +0100 (CET)


On Sat, 1 Mar 2003, Andrea Rizzi wrote:

> Hi,
> there is a speed bottleneck in kbabeldict
> 
> each time a searchengine emits 
> resultFind(SearchResult *)
> kbabeldict add it to the listview (and this is ok :-))
> 
> The problem is that the slot addResult is too slow!!!
> 
> It  want to keep the position of listview selected item
> "costant" (see kbabeldictbox.cpp  ::addResult ),  to do that it save
> the index, add the new result and then it calls
> itemAtIndex(saved index)

Does the insert inself move the selection? If not, we are OK to remove the 
code.

> this is the slower function in the world if you put about 100 entries in the 
> list.
> I also think we do not need it, a listview is a List so we do not need that 
> index based keeping, the pointer is enough.
> I think we should remove all that code...

Of course, you can use the pointer, but you really need to store the 
currently selected item always (at each call, because you don't know, if 
the user didn't change the selection in the meantime).

Stanislav