emf batch delete very slow [message #427068] |
Fri, 30 January 2009 11:13  |
Eclipse User |
|
|
|
I have a tableViewer (SWT.VIRTUAL) with about 20000 rows. The table is
backed by a AdapterFactoryContentProvider. If I select all and delete, it
takes too long, like one row per second.
Through debugger, I can see after an object is deleted from EList, the
tableViewer is notified and it is searching linearly through table items
to find the deleted object. Then does an update. That is probably why is
taking so long for 20000 rows.
Any tips are appreciated. I will try to turn off viewer updates until the
end. But not sure how to do it.
Thanks,
John
|
|
|
|
|
|
|
|
|
|
Re: emf batch delete very slow [message #427115 is a reply to message #427111] |
Mon, 02 February 2009 12:00   |
Eclipse User |
|
|
|
John,
The design is how it currently is because ViewerNotification was added
later so you'd only have them if you regenerated your *.edit projects.
So we decided to leave existing behavior just as it was so that existing
applications would definitely be unaffected. So I wouldn't anticipate
any problems from what you've done.
John Ye wrote:
>
> Ed,
>
> You are right. The logic can be simplified by calling super
> implementation:
>
> public void notifyChanged(Notification notification) {
>
> if (notification instanceof IViewerNotification) {
> } else {
> notification = new ViewerNotification(notification);
> }
> super.notifyChanged(notification);
> }
>
> I am not sure if there are side effects of always using a
> ViewerNotification.
>
> Thanks,
> John
>
>
> Ed Merks wrote:
>
>> John,
>
>> Comments below.
>
>> John Ye wrote:
>>>
>>> I logged eclipse ticket number 263175 for DeleteCommand.execute
>>> using UniqueEList.
>>>
>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=263175
>> I've committed the change.
>>>
>>> For my main problem, I overrode AdapterFactoryContentProvider's
>>> notifyChanged function to create a ViewNotification if notification
>>> is not an instance of IViewerNotification.
>>>
>>> It seems to work OK, but I did run into a couple of null pointer
>>> warnings.
>>> public void notifyChanged(Notification notification) {
>>> if (viewer != null && viewer.getControl() != null &&
>>> !viewer.getControl().isDisposed()) {
>>> if (viewerRefresh == null) {
>>> viewerRefresh = new ViewerRefresh(viewer);
>>> }
>>>
>>> if (notification instanceof IViewerNotification) {
>>> } else {
>>> notification = new ViewerNotification(notification);
>>> }
>>>
>>> if (viewerRefresh.addNotification((IViewerNotification)
>>> notification)) {
>>>
>>> viewer.getControl().getDisplay().asyncExec(viewerRefresh);
>>> }
>>> }
>>> }
>>>
>>> Suggestions are appreciated.
>> Why not just do an instanceof test, create the ViewerNotification if
>> needed, and call super to avoid duplicating any logic?
>>>
>>> Thanks,
>>> John
>>>
>
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.12433 seconds