Load about 600 nodes and 600 links, and the nodes are all svg files, and the loading time is about 9 seconds, which is a bit slow


The nodes are all svg files ,600 objects
There are more than 20 groups
Wiring is normal Wiring and has no animation

This is to use the tool to generate the drawn SVG file:

<svg width="78" height="78" viewBox="0 0 78 78" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_1198_4363)">
<rect x="68" y="39.5" width="1" height="10" transform="rotate(-90 68 39.5)" fill="black"/>
<rect y="39.5" width="1" height="10" transform="rotate(-90 0 39.5)" fill="black"/>
<rect x="10.5" y="42.5" width="7" height="57" rx="3.5" transform="rotate(-90 10.5 42.5)" stroke="black"/>
<rect x="60.5" y="42.5" width="7" height="7" rx="3.5" transform="rotate(-90 60.5 42.5)" stroke="black"/>
</g>
<defs>
<clipPath id="clip0_1198_4363">
<rect width="78" height="78" fill="white"/>

This is groups template codes:

export const cabinet_group = ($, callback, myContextMenu) => {
 return $(go.Group, "Vertical", new go.Binding("layerName", "layerName"),
   {
     layerName: "Background",
     //movable: false,
     // resizable: false, resizeObjectName: "SHAPE",
     resizable: false,
     contextMenu: myContextMenu,
     locationSpot: new go.Spot(0, 0, CellSize.width / 2, CellSize.height / 2), click: (e, obj) => {
       callback(e, obj);
     }
   },
   new go.Binding("location", "loc", go.Point.parse).makeTwoWay(go.Point.stringify),
   $(go.TextBlock,
     {
       margin: 1,
       font: "Bold 12pt Sans-Serif",
       stroke: "black",
     },
     new go.Binding("text", "text")),
   $(go.Panel, "Auto",
     $(go.Shape, "Rectangle",
       {
         parameter1: 14,
         fill: "white",
         name: "SHAPE",
         minSize: new go.Size(CellSize.width * 2, CellSize.height * 2)
       },),
     $(go.Panel, "Auto", { name: "TABLE", alignment: go.Spot.Top },
       $(go.TextBlock,
         { name: "TABLEText", text: '', stroke: "#000", font: "10px 微软雅黑, Arial, sans-serif" }
       )
     ),
     $(go.Placeholder,
       { padding: new go.Margin(10, 10, 50, 10) })
   ),
 );
}

This is one of node template codes:

export const jkLine = ($, callback, myContextMenu) => {
  return $(go.Node, "Spot", new go.Binding("layerName", "layerName"),
    {
      locationSpot: go.Spot.Center, contextMenu: myContextMenu, click: (e, obj) => {
        callback(e, obj);
      }
    },
    $(go.Picture, { desiredSize: new go.Size(65, 65), cursor: 'pointer' }, { source: require("@/assets/images/jkline.svg"), angle: 0 }),

    $(go.Shape, portStyle(true),
      { portId: "input", alignment: go.Spot.Left, fromLinkable: true, toMaxLinks: 1, width: 1, height: 1 }
    ),
    $(go.Shape, portStyle(false),
      { portId: "out", alignment: go.Spot.Right, toLinkable: true, toMaxLinks: 1, width: 1, height: 1 }),
    $(go.TextBlock,
      { name: "TABLEText",   stroke: "#000", font: "10px 微软雅黑, Arial, sans-serif", wrap: go.TextBlock.WrapFit, 
         }
    )
  );
}

This is links template codes:

export const line = ($) => {
  return $(go.Link, new go.Binding("layerName", "layerName"),
    {
      routing: go.Link.Orthogonal,
      curve: go.Link.JumpOver,
      curviness: 0,
      relinkableFrom: true, relinkableTo: true,reshapable: true,
      resegmentable: true,
      selectionAdorned: false,
      shadowOffset: new go.Point(0, 0), shadowBlur: 5, shadowColor: "blue",
    },
    $(go.Shape,{ name: "SHAPE", strokeWidth: 1, stroke: 'black' }),
  );
}

This is links Layout codes:

myDiagram.layout = $(go.LayeredDigraphLayout, {
		direction: 0, //方向
		layerSpacing: 1, //图形间距
		columnSpacing: 100, //列间距
		layeringOption: go.LayeredDigraphLayout.LayerLongestPathSource, //分层排列
		initializeOption: go.LayeredDigraphLayout.InitDepthFirstIn, //
		aggressiveOption: go.LayeredDigraphLayout.AggressiveMore, //排列少交叉
		packOption: 1, //线链接方式 
	});

Thank You walter

If you temporarily remove the setting of your Picture.source property, how fast does that large model/graph load?

I bet the problem is not with the SVG images but with the LayeredDigraphLayout. Are you using GoJS v3.0 (preferably the latest)? If so, don’t set packOption. If you are using GoJS v2.3, also set alignOption.

Thank you for your reply. It took up your rest time.
The version I am using is v2.1.38. I will confirm the problem after updating the version. Or what configuration items do I need to modify in this version?

I’m trying to get you to use the new LayeredDigraphLayout using the alignOption, which was new in 2.3, and which is the default in 3.0.

I upgraded to version v2.3.17 and Modify it to the following code:

myDiagram.layout = $(go.LayeredDigraphLayout, {
		direction: 0, //方向
		layerSpacing: 1, //图形间距
		columnSpacing: 100, //列间距
		layeringOption: go.LayeredDigraphLayout.LayerLongestPathSource, //分层排列
		initializeOption: go.LayeredDigraphLayout.InitDepthFirstIn, //
		aggressiveOption: go.LayeredDigraphLayout.AggressiveMore, //排列少交叉
		//packOption:1,
		alignOption:go.LayeredDigraphLayout.AlignAll,
	});

The loading speed has not improved
The layout has become a bit looser

I also experimented with the latest version v3.0.12 Deleted packOption and alignOption,
loading speed has not improved

OK, so the time consuming operation was not the layout as I was guessing. Did you check what you thought the problem is?

Also, try not setting Link.curve.

This is the way to load data dynamically, I don’t know if that’s the problem

remove the setting of Picture and not setting Link.curve
2 seconds faster and 7 seconds to load

It would be more useful if you could test not setting the Picture.source and not setting Link.curve separately to see which one is causing the slowdown.

Also, what properties have you set on your Diagram?

not setting the Picture.source and not setting Link.curve
None of them have any noticeable effect
not setting Link.curve It can be sped up by about one second
not setting the Picture.source Doesn’t improve speed
This is Diagram

export const initGojs = (eleID,overviewID,contextMenu,changeModel) => {
		if (myDiagram) {
			myDiagram.div = null; // 重新渲染时需清空div
		}
		//初始化gojs
		myDiagram = $(go.Diagram, eleID, {
			"initialContentAlignment": go.Spot.Center,
			//initialAutoScale: go.Diagram.Uniform,
			initialDocumentSpot: go.Spot.Center,
			initialViewportSpot: go.Spot.Center,
			"toolManager.mouseWheelBehavior": go.ToolManager.WheelZoom,
			'grid.visible': true,
			"grid.gridCellSize": new go.Size(10, 10),
			initialScale:0.4,
			maxScale: 6, //最大视图的放大比例
			hasHorizontalScrollbar: false, //纵向滚动条隐藏
			hasVerticalScrollbar: false, //横向滚动条隐藏
			contentAlignment: go.Spot.Center, //图形居中
			padding: 100, //内边距
			layout: $(go.GridLayout, {
				wrappingColumn: 3,
			}), //布局
			"ModelChanged": changeModel//新增事件
		});
		//缩略图
		 var myOverview =
			$(go.Overview, overviewID,
			  { observed: myDiagram });
		myContextMenu = contextMenu;
};

I don’t see anything obviously wrong with your Diagram definition. So I don’t know what to say. Have you tried different browsers? On different platforms?

Have you read Performance Considerations | GoJS ?

Is there any way you could give us a complete stand-alone sample so that we could reproduce the problem?

20241024153153
Modified to go.TreeLayout,The loading speed is milliseconds
My graph needs to show a horizontal directed graph starting with multiple initial nodes, and the more initial nodes there are, the slower the load will be.
go.TreeLayout is OK
Thanks :)