Book a Demo

Author Topic: Addin performance observation  (Read 5674 times)

OilyRag

  • EA User
  • **
  • Posts: 32
  • Karma: +0/-0
    • View Profile
Addin performance observation
« on: April 07, 2008, 05:43:35 pm »
Recently, I modified a .net c# add-in designed for document generation, such that I split it into an Active-X control, and a small add-in to activate it within EA. The document generation control then opens in the pane within EA where diagrams appear.

This was just  an experiment but I am fairly sure that the document generation process I had created now seems to run faster within the Active-X control as opposed to previously when it ran in a thread created and started by the add-in itself.

Am I imagining things or is there some theoretical reason for this?
Have any others observed this in their own add-in development?
I would guess not many have actually done the migration thing from add-in to active-x control but if there are any of you out there who have, do you have any similar observations?
 :)
The things I make may be for others, but how I make them is for me.

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Addin performance observation
« Reply #1 on: April 07, 2008, 08:15:00 pm »
I suspect there is a lot of 'chatter' going back and forth when you create documentation, let alone the overhead of talking with EA. When going from the COM world to .Net this is generally pretty expensive. Perhaps your ActiveX control is saving you this overhead.
No, you can't have it!

thomas.kilian

  • Guest
Re: Addin performance observation
« Reply #2 on: April 07, 2008, 09:02:39 pm »
Maybe Matt from TimeArchitect could give you an answer. TA is using this ActiveX extensively. I'm just running the Add-Ins without A-X. I posted somewhere else that EA does unfortunately not support a real cache so the user has to invent it by his own.

OilyRag

  • EA User
  • **
  • Posts: 32
  • Karma: +0/-0
    • View Profile
Re: Addin performance observation
« Reply #3 on: April 07, 2008, 11:22:26 pm »
I did another experiment.

I made a form that contained my custom document generation control so that I could run it either as a dialog or as an active-x control so I could quickly try each method back-to-back and compare them.

Right now, my document generation code does very little. It just recursively parses packages in the EA repository and prints their names to a list along with notional section numbers. What this means is that lots of packages and elements are read (each one, once only) via the automation interface during the parsing, but not a lot else is happening.

Using the exact same document model data:
Time to generate when running in a dialog: 60 seconds
Time to generate when running as an active-x control: 16 seconds

This is a massive improvement.  :o
The things I make may be for others, but how I make them is for me.

Kevin Winchester

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: Addin performance observation
« Reply #4 on: April 11, 2008, 11:47:10 pm »
Hi,

I have been attempting to improve my .NET AddIn performance for a while now.  Thus I am very interested in your results.  Can you give more details about the organization of your code?

It would be very helpful if you could even post the code for your experiment, to show the difference between performing your document generation with a dialog or an ActiveX control (of course you would not need to include any of your document generation code - just the AddIn/ActiveX code).

Thank you,
Kevin
Kevin Winchester

OilyRag

  • EA User
  • **
  • Posts: 32
  • Karma: +0/-0
    • View Profile
Re: Addin performance observation
« Reply #5 on: April 14, 2008, 09:45:27 am »
Hi Kevin
It would take a bit of work to strip down my code to the point where I could post it here, so let me explain exactly what I did.

For a while, all of my add-ins were being used via the menu system, and when needed, I would open  a dialog or two, and for lengthy operations, do that in a thread so that a user is not locked out of EA while the operation takes place. Initially, I was happy with that, not knowing any better. But the use of the context sensitive menu to access add-in functionality began to irk me. The menu lag sometimes was troublesome, even though I did all I can to reduce it, but when you have a lot of add-ins...argh. So, I decided to try this ActiveX thing.

I designed a custom control in VS.Net with loads of buttons and other controls on it to execute my add-in's functions. I also created a dialog form and put the custom control on it. The only two menu options in my addin were to either open the dialog form, or put the custom control in EA's dialog frame using the AddTab() automation function. Then, you can run the functions of the add-in in either way to compare the performance. The difference was very noticable.

At the time, my document generation processing was just parsing EA model data and printing diagnostics to the output tab, not actually generating a document. The algorithm for parsing the model was something like (with all extraneous detail removed):

function parse-document-model is
   call parse-package, passing in the document-model package

function parse-package is
   print package diagnostics
   for each diagram in package
      print diagram diagnostics
   for each sub-package in package
      call parse-package (ie. recurse)
   for each element in package
      call parse-element

funtion parse-element is
   print element diagnostics
   for each subElement in element
      call parse-element  (ie. recurse)

If I find time I will try and post some code. to demonstrate this. Give me a week or so.  ;)
The things I make may be for others, but how I make them is for me.

Kevin Winchester

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: Addin performance observation
« Reply #6 on: April 14, 2008, 10:04:47 am »
Thanks for the explanation - that is very helpful!

I experimented with (what I think) is a very similar setup to yours - that is, I created a .NET Windows Forms UserControl (which can act as an ActiveX control), and used an EA AddIn menu command to invoke it with the AddTab method.  However, I did not get any speed up of my processing - the command actually ran slower from the ActiveX control.

That led me one more question that should be quick for you to answer.  Once you call AddTab to create the ActiveX control, do you pass the actual EA.Repository object to the control, or do you pass a string that is a filename to open with the Repository.OpenFile() method?  And is that any different from when you work without the ActiveX control?

Thanks again,
Kevin

Kevin Winchester

OilyRag

  • EA User
  • **
  • Posts: 32
  • Karma: +0/-0
    • View Profile
Re: Addin performance observation
« Reply #7 on: April 14, 2008, 10:47:15 am »
I have just written a little program to test my assertion that code in an activeX control runs quicker than it does if run within a dialog. Well, it does, if you (like me) had your dialog code running in a thread, but if on the other hand, your dialog was just opened directly from the EA_MenuClick function, then it does not.
 :(

Personally, I dont like tying up EA when a long process, started from  a dialog or menu is carried out. If that process crashes, so does EA. You might lose work? So, I have been using threads for some time now, but only now have I realised you pay quite a high price for using them.

Lesson learned.
 :-[
« Last Edit: April 14, 2008, 10:48:18 am by OilyRag »
The things I make may be for others, but how I make them is for me.