Dragging in Stencil Library Shape takes longer than expected

Started by freefora11, March 14, 2023, 04:55:22 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


Here is a video link demonstrating the problem: https://www.berrycast.com/conversations/7ab8cf38-62ba-5593-a637-4178afbb6cf1

Summary of the problem:

  • I have template in a stencil that has around 800 shapes (based off seeing a shape id of 820)
  • This stencil has a lot of User Data and Shape Data
  • Dragging Stencil onto Page takes 40 seconds to 60 seconds
  • Dragging Stencil onto the Page a additional times after first time, takes 3 seconds

What can I do to improve the performance? Note that I am writing an addon that automates setting Shape data for these shapes, but the addon is not being used at all in this demo. Let me know if you need additional information.

Here is another video explaining more depth of what these shapes do, looking at the shape sheet, how I hide certain shapes, etc.

FYI, using Microsoft Visio Pro 2016 if that matters.
Visio Pro 2016
C# VSTO Visio Addons


Interesting performance problem, don't know the solution but following with interest.
Visio 2021 Professional


I do believe it has something to do with my Shape Data and User data within the Stencil. I have a similiar Stencil library with a very similiar group shape as shown. The main difference is the new one has a few more shapes (like 30 or so) and it has Shape Data and User Data. I don't have any circular references. Most of my User Data are just pointers to the parent shape to keep my other formulas clean. I'm not doing anything crazy, mostly adding/subracting/multiply/dividing.

More background if anyone cares. The reason I've rebuilt my Stencil Library is to use Shape Data and User Data. I want Visio to do more of the heavy lifting of positioning child shapes. My old way was using the addon I've built to position and size every single shape. I'm refactoring my addon to just change Shape Data now, which in theory should improve performance since I'm not having to do all of that positioning within the Addon. Its fewer calls to the COM objects. But I'm seeing a huge performance dip since I've moved most of the logic to the Shapesheet.
Visio Pro 2016
C# VSTO Visio Addons


I don't know if it really relates to your problem, but I observed that when I'm remotely connected to our network, many operations last much longer than when I'm offline.
I suspect that Visio is searching for some resources, that it doesn't when I'm offline.
Would that be something to investigate?

Looking at your video it is as in the first drop Visio hasn't got yet all the necessary data. Then the master is there and everything goes faster.

You may also look at the document tree - masters, styles, number of shapes ,...
and specially at the shapesheets of document and pages. Are there "bigger" user/prop/scratch/ sections?
how do these shapesheets look before and after the first drop look.

Do the masters refer to cells in the doc or the page that don't exist yet in a virgin document?


PS - Silly idea: you may start from a template where you would already have done the first drop???

PPS: Just tested a stencil with a master containing exactly 800 subshapes. The number itself seems not to matter. Dropping performed in less than an eye blink.


freefora11 I have seen a Microsoft Video (I think from Ignite) where they announced that they overhauled the Visio engine in Visio 2019 for performance, but I don't know if that would help this particular case as Microsoft didn't give much info it other than that the Visio engine has better performance since Visio 2019.

When you say you 'dragged in the stencil', do you mean dropping all 800(+) shapes in the stencil on to a page and that takes 40 to 60 seconds?

I have noticed that group shapes with just 10 shapes are slower on first drop, Visio seems to have to do a lot of work the first time for some reason.
Visio 2021 Professional


I woke up this morning where my computer restarted (patch tuesday!), I tried importing it again and now its less than 5 seconds!! Something as silly as restarting your computer solved the issue. What makes me mad is I thought I already did that.

To answer some of your questions, none of the shapes refer to the document nor the page. I was going to try your idea where I already made the first drop, but since my machine restarted, everything works properly now. Love the idea though! Thanks for verifying that having 800 shapes doesn't make a difference.

At work, I can get access to Visio 2019 since some of our users do have it. Luckily I don't need to try that, but that is good to know that 2019 made performance improvements. We might have to look into buying some 2021 licenses so we can get the security updates since 2016 is EOL.
Visio Pro 2016
C# VSTO Visio Addons