This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 134585 - ModelFactory and ModelSource performance needs improvement
Summary: ModelFactory and ModelSource performance needs improvement
Status: RESOLVED INCOMPLETE
Alias: None
Product: xml
Classification: Unclassified
Component: XAM (show other bugs)
Version: 5.x
Hardware: All All
: P2 blocker (vote)
Assignee: Nikita Krjukov
URL:
Keywords: UMBRELLA
: 125937 (view as bug list)
Depends on:
Blocks: 132316 124254
  Show dependency tree
 
Reported: 2008-05-06 11:28 UTC by Alexey Yarmolenko
Modified: 2009-07-30 13:25 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexey Yarmolenko 2008-05-06 11:28:38 UTC
We recently investigated performance issues on BPEL mapper and BPEL diagram and found that one of the major reasons for
performance leaks is located in ModelSource lookup.

This problem is mostly related to IZ125937, but this time I want to extend the problem scope and provide more scenarios,
so I filed this new issue.

So,  2 places, where we have performance problems are:

1. Get XAM model by given file object.
2. Get file object by given XAM model

First one is called every time when reference resolver is trying to resolve cross-model reference. For example, this was
a main cause for IZ130061.

Second place is involved in scenarios, where we need to know read-only state of the model, such as enabling/disabling
menu items, responding to DnD events and showing editors in property sheets. So, having slightest delays here also
decreasing UI responsiveness a lot. 

So, basic solution I see here is again in area of improving ModelSource Lookup's performance. Profiling shows that now
it suffers from timing of _getDocument() method. This method is called when we trying to query ModelSource lookup for
ANY type of object, such as FileObject, DataObject, ModelAccessProvider. 

In issue 125937 we tried to avoid this by caching Document returned by _getDocument() method, but this created a
regression around xml source and model synchronization. New proposed solution is to create lookup which will call
_getDocument() ONLY WHEN lookup is queried for corresponding object type. All other objects, stored in lookup are
constants and fixed lookup can be used to store them. This can be achieved with using AbstractLookup together with
InstanceContent.Convertor for Document-type content. This lookup can be combined using ProxyLookup with fixed lookup,
storing FileObject, DataObject and other constants. This should greatly reduce time required to query ModelSource lookup
for FileObject and as a result, improve ModelSource cache performance.

To provide further performance gains, we can add new utility method in ModelFactory, which will return Model by given
FileObject. Additional caching of FileObject->Model pairs is requied to avoid querying ModelSource lookup completely.
This utility method should try to find already loaded Model by given file object, and if not found, construct new
ModelSource and call old method. This will also simplify a client code, because i found about 4 similar methods doing
this only in BPEL editor module. All these helper methods can be removed in favor of this new ModelFactory method.
Comment 1 Samaresh Panda 2008-05-28 16:52:02 UTC
Can I see some profiler snapshots that points to performance leaks in modelsource creation and lookup? I mean how much
time does it take? Do you have some tests/projects that I can run and see for myself?

Also it seems like you have done some work on it already. Do you have a patch that I can try and see improvements?
Comment 2 Sergey Lunegov 2008-11-21 14:10:50 UTC
Sam, we'd like this one to be implemented in 7.0.
Comment 3 Samaresh Panda 2008-12-03 23:21:23 UTC
*** Issue 125937 has been marked as a duplicate of this issue. ***
Comment 4 Samaresh Panda 2008-12-05 01:07:04 UTC
Let me ask again. Do you have some data to back the theory behind poor performance in ModelFacotory and ModelSource?
Comment 5 Samaresh Panda 2008-12-05 01:08:47 UTC
Updated priority appropriately.
Comment 6 Nikita Krjukov 2009-03-19 18:56:53 UTC
The performance of Schema models was significantly improved with the fix for the issue #158236. 
But it relates to schema models only. And also the issue #158236 probably doesn't cover all problems are implied here. 
Unfortunately it isn't real to use the approach is used for #158236 in general case. It uses schema's specifics. 

I think this issue can be considered as an umbrella issue. More specific issues should be created to show particular
use-case. Such issues should contain NetBeans projects to experiment with. 

Comment 7 Sergey Lunegov 2009-07-30 13:25:46 UTC
Do we still consider it as an umbrella ? If not please close as FIXED.