Odd (and significant!) performance hit

288
1
06-25-2020 03:45 PM
JeffBoyton
New Contributor II
To help debug performance issues we are seeing in another add-in, I created a new, simple add-in with one button which adds 50 point text elements at random positions on an empty layout. I did tests with and without a map tab open. Here is the code for adding an modifying the elements:
 
GraphicElement element = LayoutElementFactory.Instance.CreatePointTextGraphicElement(layout, location.Coordinate2D, text);
element.SetAnchor(Anchor.LeftMidPoint);
element.SetRotation(ELEMENT_ANGLE);
 
Here are my test results:
Create, SetAnchor, and SetRotation on 50 elements with no map in project: ~3s
Create elements only on 50 elements with map tab open: ~20s
Create and SetAnchor on 50 elements with map tab open: ~2m
Create, SetAnchor, and SetRotation on 50 elements with map tab open: ~3m
Create, SetAnchor, and SetRotation on 50 elements with closed map in project: ~3s
 
In all of these cases, the layout being modified was in the project contents, but not an open tab. The map was empty, and had no connection to the layout other than being in the same project.
 
I would not expect having a map tab open to affect the performance of adding elements to an unrelated layout. Am I doing something wrong here? Is it possible to improve performance with the map tab open?
0 Kudos
1 Reply
AdamDavis
Occasional Contributor

Hi Jeff,

I can concur there are some serious performance issues with adding Graphics Elements in 2.5 when other tabs are open. We have a slightly different situation but it's essentially the same result.

Our add-in does some map frame cloning and adding quite a few graphic elements on a number of layouts.

If we have ANY layout open (not just the ones we are working on) then our code finishes (not quickly but it does finish) but Pro then goes into a unresponsive state for up to 4 hours (around 20 layouts). If we close all layouts programatically before we start then it only hangs for around 15 minutes.

It think it also may be related to your post on 11 May with bulk adding of GraphicElements and Uma's bulk creation overloads where i would imagine they are disconnecting UI updates for the duration of the bulk addition.

What would be more useful would be a way to programatically turn UI updates off for the duration of a Task and only have UI update at the end.

Adam

0 Kudos