Author Topic: Shape limitations Maximum  (Read 1002 times)

0 Members and 1 Guest are viewing this topic.

jerry_csa

  • Newbie
  • *
  • Posts: 1
Shape limitations Maximum
« on: August 23, 2019, 07:58:07 AM »


Is there a maximum number?

Using interop:
 I am dropping shapes into diagram and as number goes up the amount of time between the drops continually increases.

is there a way to avoid this .. more layers .. not selecting shapes as they drop ...


Paul Herber

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2955
    • Paul Herber's website
Re: Shape limitations Maximum
« Reply #1 on: August 23, 2019, 08:43:40 AM »
There are no limits, it just gets slower. This is normal, nothing can be done about it but it does take hundreds/thousands of shapes for it to really make a difference.
I wrote a short article about it some time ago:
http://www.paulherber.co.uk/articles/visio-articles/visio-slowdown/

Electronic and Electrical engineering, business and software stencils and applications for Visio -

https://www.paulherber.co.uk/

Visisthebest

  • Full Member
  • ***
  • Posts: 174
Re: Shape limitations Maximum
« Reply #2 on: September 19, 2020, 03:29:16 AM »
Paul thank you for testing this, but isn’t the SheetID 2-byte integer size limiting the amount of shapes on a page?

Methods like these:
https://docs.microsoft.com/nl-nl/office/vba/api/visio.page.getformulas

Specify a 2-byte integer for the sheet ID, so I guess that about 32.000 or 64.000(?) shapes/subshapes on a page is the maximum. What do you think?

I wonder if Visio 2019 will be much faster on an AMD 4800U 8-core CPU with 16GB running really large diagrams, these superfast laptops are well below $1000 now.

Paul Herber

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2955
    • Paul Herber's website
Re: Shape limitations Maximum
« Reply #3 on: September 19, 2020, 08:08:15 AM »
I think other limitations are likely to come into operation before the 2-byte int range is exceeded.
Electronic and Electrical engineering, business and software stencils and applications for Visio -

https://www.paulherber.co.uk/

Nikolay

  • Hero Member
  • *****
  • Posts: 972
    • UnmanagedVisio
Re: Shape limitations Maximum
« Reply #4 on: September 19, 2020, 10:17:08 AM »
I wonder if Visio 2019 will be much faster on an AMD 4800U 8-core CPU with 16GB running really large diagrams, these superfast laptops are well below $1000 now.

Just wondering if the number of cores matters? Isn't Visio recalculation engine single-threaded (so it can use only one core)?
« Last Edit: September 20, 2020, 09:42:51 AM by Nikolay »

Visisthebest

  • Full Member
  • ***
  • Posts: 174
Re: Shape limitations Maximum
« Reply #5 on: September 19, 2020, 03:28:58 PM »
Nikolay if this is so then there is still great room for performance improvement in the Visio rendering engine!

I know Excel takes advantage of multiple cores especially in calculation-intensive spreadsheets.

Visisthebest

  • Full Member
  • ***
  • Posts: 174
Re: Shape limitations Maximum
« Reply #6 on: September 20, 2020, 05:52:42 AM »
Paul do you know if the 2-byte range for the Shape ID is a hard limit? I am asking because this would allow for a VBA Array lookup table of a dimension of no more than 65536 items seriously speeding up some algorithms we use, in particular making performance more linear and predictable in 3000+ (sub)shape diagrams.

Nikolay

  • Hero Member
  • *****
  • Posts: 972
    • UnmanagedVisio
Re: Shape limitations Maximum
« Reply #7 on: September 20, 2020, 09:31:35 AM »
Shape ID is 32 bit ("long", in VBA terms)

The limitation of 2-byte array applies only to the SetFormulas/GetFormulas functions, probably for historical reasons.
Anyways, Visio will sure be dead long before you actually try to put 64.000 shapes on a diagram, so I would not worry about that much.

A huge number of details while keeping number of shapes/recalculations low is usually achieved by using vector-style-images (wmf, emf, svg) as shapes.
This is done by most equipment stencil providers, like CISCO, HP, etc.   
This approach allows you to have basic operations like move/resize (as a group), while not consuming costly computational resources for formulas.
Basically, usually you don't really need "smartness" for every single detail shape (except for basic move/resize), you need "smartness" only at the "top" level.
« Last Edit: September 20, 2020, 09:39:00 AM by Nikolay »

Paul Herber

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2955
    • Paul Herber's website
Re: Shape limitations Maximum
« Reply #8 on: September 20, 2020, 10:24:20 AM »
It's not a number that can be contained within 2 bytes. I've just created a diagram containing one of my computer chip packages shapes, a QFP-144, which is a grouped shape containing 290 sub-shapes. I duplicated this shape repeatedly until the shape IDs went up over 65535, in fact I got to nearly 70000. As the diagram is only 1 master shape the saved file isn't too large, just under 1MB.
P.S. this was 237 shapes.
Electronic and Electrical engineering, business and software stencils and applications for Visio -

https://www.paulherber.co.uk/

Visisthebest

  • Full Member
  • ***
  • Posts: 174
Re: Shape limitations Maximum
« Reply #9 on: September 21, 2020, 05:21:50 AM »
Nikolay thank you that is a good idea to use WMF/EMG/SVG pictures for more complicated shapes (visually) that only have simple behavior, I wonder if a diagram with hundreds of shapes with gradients will become faster in Visio for instance (on older laptops, diagrams with several hundreds of shapes with gradients can become quite slow in my experience).

Paul thank you for doing this test! I think I'll go through the page's shapes collection first to find the highest ID before making the lookup Array because obviously a max 65536-size array might have edge cases like your shapes with ID's over 70.000!

 Looks like the SetFormulas/GetFormulas and DropMany methods have some edge cases as well!

If you use DropMany:
https://docs.microsoft.com/en-us/office/vba/api/visio.page.dropmany

but there are 65536 shapes on the diagram, then the Array returned (of shapes dropped) with have some pretty interesting integer-size IDs. Good to build in some checking of the highest shape ID number on the page before doing a DropMany.