Visio 2003 add-in performance issue

J

jeremy.J

Hi,

we developped a Visio addin for modeling electrical network.

This addin works well for drawing with hundreds of shapes but proves to be
very slow with the ultimate size we are targetting (about 3000 shapes).

Total time for opening the drawing is more than 50 seconds (it is almost
instantaneous whithout the add-in).

(100 % CPU usage for one of the dual core processors during all this time)

The environment I am using is :
Windows XP SP 3
MS Office Visio 2003
Compilation environment: MS Visual Studio 2003 (VB6)
Processor: Intel Core 2Duo

Using a code profiler I found out that most of the time is elapsed in our
"checkconnectivity" function which makes sure that all the connectors are
correctly connected.

One of the main functions of our Add-in is to propagate to a shape
connection point the information of which shape is connected on the other
side of the connector.

This information is stored in dedicated custom properties upon connection.

The check connectivity function sequentially calls the following functions
to make sure those information are correctly set :

Microsoft.Office.Interop.Visio.IVShape.get_Connects( ) is called 11,094
times for a total duration of 19.249 seconds

Microsoft.Office.Interop.Visio.IVShape.get_Cells(string
localeSpecificCellName) is called 11,094 times for a total duration of 16.120
seconds

This processing does not make any write call.

Are this performance normal ?

Would anyone have a solution to increase the performance of those calls ?

Thanks for your help.
 
P

Paul Herber

Working though 3000 shapes will take a while. However, it does depend
a huge amount on what you are doing with the shapes.
Do you iterate through each page/shape checking connections?
Do you work with just one shape at a time or do you read everything
into a data structure?
Ah, reading a bit more you appear to be writing this information back
into the shapes.
Reading 3000 shapes then writing back out out to those 3000 shapes -
50 seconds with VB - doesn't surpise me.
 
J

jeremy.J

Would it be faster using another language than VB.NET (e.g. C#) ?
As they are both managed code I don't thinbk so but what is your idea ?
 
J

John Goldsmith \(Visio MVP\)

P

Paul Herber

Hi,

we developped a Visio addin for modeling electrical network.

This addin works well for drawing with hundreds of shapes but proves to be
very slow with the ultimate size we are targetting (about 3000 shapes).

Total time for opening the drawing is more than 50 seconds (it is almost
instantaneous whithout the add-in).

Just had another thought - I assume you are doing this whenever the
document is opened.
How about this, when the document has been opened and checked write a
timestamp into the document user properties. Now in the future when
the document is opened check the file's save timestamp and compare
with the saved one. You'll have to make some allowance for the fact
that it's going to take a while to write a document of 3000 shapes,
but if the timestamp is within say 2 minutes then you can safely say
that the document hasn't been changed since it was last checked.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top