Book a Demo

Author Topic: Import Elements - Refresh and Update take too long  (Read 5350 times)

blue5teel

  • EA User
  • **
  • Posts: 25
  • Karma: +0/-0
    • View Profile
Import Elements - Refresh and Update take too long
« on: November 25, 2010, 01:49:21 am »
Hello community,

currently i am making an import add-in for EA.
The objects are stored in an xml file.

For each object i generate an EA.Element and make some updates and refreshes.
Code: [Select]
EA.Element subElement = constructElement(element, subReq);
subElement.Update();
subElement.Refresh();

I generate some tagged values too and call update.
Then i update the package containing the element.
Furthermore i make a diagram and a diagramobject for each element. Some updates and refreshes following.

It takes decades to import 1000 objects.

Are there any recommendations for using refresh and update. Can i save some time not calling them? Or are there other bottlenecks?
« Last Edit: November 25, 2010, 01:50:23 am by blue5teel »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13495
  • Karma: +572/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Import Elements - Refresh and Update take too
« Reply #1 on: November 25, 2010, 05:33:00 pm »
Hi,

I think you can go without the refresh operation for each element. You can do a Repository.RefreshModelView() after you finished importing everything.

Some other options you can try to increase performance are:
- Repository.BatchAppend
- Repository.EnableCache
- Repository.EnableUIUpdates

Without further details of your code I can't really do any more recommendations.
What you could do is look at the excel importer I published on the community site. I had some performance issues there too, and I was able to increase the speed quite a lot. IIRC it imports 10.000 lines in a matter of minutes, but I would have to test it to be sure.

Geert

blue5teel

  • EA User
  • **
  • Posts: 25
  • Karma: +0/-0
    • View Profile
Re: Import Elements - Refresh and Update take too
« Reply #2 on: November 25, 2010, 08:44:32 pm »
Thx Mister Bellekens,

i kicked the refresh operations and got some improvement.
1000 elements take 7 minutes now.

BatchAppend and EnableUIUpdate did just some minor improvements (seconds). EnableCache seems to even increase the computation time.

But i have to do some more research.

thx.


blue5teel

  • EA User
  • **
  • Posts: 25
  • Karma: +0/-0
    • View Profile
[Solved]Refresh and Update for Elements take too l
« Reply #3 on: November 25, 2010, 09:18:57 pm »
Ok.

I made a big mistake.  :-[
Everytime i made an element or diagram update i updated their parent package too. I removed those updates and it showed that these updates are not neccessary.

I decreased the computation time from 7 minutes to 40 seconds!

Sorry  :-[

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13495
  • Karma: +572/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Import Elements - Refresh and Update take too
« Reply #4 on: November 25, 2010, 09:23:11 pm »
Quote
Thx Mister Bellekens
Whoa, "Mister Bellekens" is my dad, just "Geert" is enough  ;)
(I know, must be difficult for someone who addresses his colleagues with Herr/Frau <lastname>)

In fact, when I was working on the performance issues with my addins the VS Performance Analysis helped a lot. It also showed that most of the processing time was spent doing countless database calls.
So the trick to is avoid database calls as much as possible.

On of the really weird things with the API is that is even does one or more database calls while iterating an EA.Collection. So the trick is to only iterate a certain collection one, and as soon as you have an EA.Element, EA.Attribute,...  store it in something sensible, like a "real" Collection (List<> or something like that).

Geert

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13495
  • Karma: +572/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: [Solved]Refresh and Update for Elements take t
« Reply #5 on: November 25, 2010, 09:26:04 pm »
Quote
I decreased the computation time from 7 minutes to 40 seconds!

That quite an improvement.
Now put the package.updates back an install it like that. After the users start complaining you can be the hero by improving the performance by this much  ;D

Geert

blue5teel

  • EA User
  • **
  • Posts: 25
  • Karma: +0/-0
    • View Profile
Re: Import Elements - Refresh and Update take too
« Reply #6 on: November 25, 2010, 09:32:02 pm »
Lol  ;D

Before i can make those improvements they will kill me for my incompetence.  ;)