Re: Slow performance

Martin Matula <[email protected]> Thu, 10 Jul 2003 23:56:40 +0200
Newsgroups gmane.comp.java.netbeans.modules.mdr.devel
Message-ID <[email protected]>
Hi Anders,
I think the reason why the operation is so slow is because of the 
DependsOn association defined in MOF. It is defined so that it should 
return all the objects that a given object depends on (by any kind of 
other relationships/associations) transitively. This basically means 
that every object is in "DependsOn" relationship with any other object. 
I am not sure about the usefulness of this association in MOF but it is 
there and we have to implement it. Anyway, when you are doing this kind 
of iteration, you should rather restrict the iteration only to 
non-derived associations - those carry all the original information. 
DependsOn is just a derived association (it is computed when you access 
it from the other associations). To do this, you should modify your code 
in a following way:
 > for all in outermost.refAllPackages -> pkg
 >  for all in pkg.refAllAssociations ->  as
       if (!((Association) as.refMetaObject()).isDerived())
 >         for all in as.refAllLinks
               ...

Btw., why are you doing this kind of iterations for the JTree you want 
to construct? If you know you are operating on the MOF metamodel 
(reading information about UML metamodel), you can build the tree based 
on containment hierarchy (as we did it for MOF extents in MDR explorer).
If you want to build a generic browser, you may want to show separate 
node for each association and fetch the data from MDR only when the 
association node is expanded. Also you may consider exploring the 
metamodel and show all the references of a class under each object node 
and make navigation from a given object to the related objects possible 
(as we did it in the "reflective" view in MDR Explorer).
Or do I misunderstand your goal?
Regards,
Martin
---

Anders W. Tell wrote:
> Hi,
> 
> Im creating a UI for viewing MDR /JMI artifacts for the UML 15. 
> metamodel. When doing the following traversal MDR takes for ever to 
> complete.
> 
> for all in outermost.refAllPackages -> pkg
>  for all in pkg.refAllAssociations ->  as
>     for all in as.refAllLinks
>        --- here it loops calling ModelElementImpl.recursiveFindDeps,  ---
> 
> Basically I want to form a JTree with the artifacts in UML 15 metamodel. 
> Im using the memory database not BTREE for fast performance.
> 
> Is this a common problem or is a problem with the loop or ....
> 
> cheers
> /anders
>