1.combineProcessedData perform removeDuplicates on every single graphList with significant growth rates on according to data size... results in huge consumption in JSHeap.
dispatch is expensive due to the nature of immutability, results in huge execution time on data processing.
Every single toggle requires to perform loops repeatedly on all the graph list.
Set graphFlatten to [];
For graphData in graphList
If graphData.metadata.visible = true
Call groupEdgeForImportation with graphData and groupEdgeField return groupEdgeGraph
duplicateDictionary
obtainGroupEdgeIds
aggregateGroupEdges
produceGraphWithGroupEdges
aggregateMetadataFields
combineEdgeFields
Set graphData = groupEdgeGraph
Endif
// O(nodes + edges + nodeFields+ edgeFields)
Call combinedProcessData
removeDuplicates
Endfor
Solutions
Turn Graph List Visibility Off
To prevent the feature requires to perform looping and merging on every graph list. With the metadata.ids and metadata.groupEdge.fields setup in #179 , we will use the nodeIds, edgeIds and groupEdgeIds to perform removal from the graphFlatten.
This operation reduce the time complexity from O(n*3) to O(n).
function disableGraphVisibility (index, isVisible)
// obtain stores data
Set graphList to state.graphList;
Set graphFlatten to state.graphFlatten;
// modify visibility and obtain specific graph
Set graphList[index].visible = isVisible;
Set graphData to graphList[index];
Set nodeIdsForRemoval to graphData.metadata.ids.node
Set edgeIdsForRemoval to graphData.metadata.ids.edge and graphData.metadata.groupEdge.fields.key
// Remove all nodes and edges of specific graph
Call graphFlatten.graphNodeEntity.removeAll(nodeIdsForRemoval)
Call graphFlatten.graphEdgeEntity.removeAll(edgeIdsForRemoval)
Set state.graphFlatten = graphFlatten
end function
Turn Graph List Visibility On
To prevent the feature requires to perform looping and merging on every graph list. With the metadata.ids and metadata.groupEdge.fields setup in #179 , we will use the nodeIds, edgeIds and groupEdgeIds to perform insertion into the graphFlatten.
This operation reduce the time complexity from O(n^3) to O(n^2).
function enableGraphVisiblity (index, isVisible)
// obtain stores data
Set graphList to state.graphList;
Set graphFlatten to state.graphFlatten;
// modify visibility and obtain specific graph
Set graphList[index].visible = isVisible;
Set graphData to graphList[index];
Set modData = graphData
if graphData.metadata.groupEdge.toggle = true
Call groupEdgeForImportation with graphData return groupEdgeData and groupEdgeIds;
Set modData = groupEdgeData;
Set modData.metadata.groupEdge.ids = groupEdgeIds;
endif
Call combinedProcessedData(modData, graphFlatten) return mergedGraph;
Set state.graphFlatten = mergedGraph
end function
Root Cause
1.
combineProcessedData
performremoveDuplicates
on every singlegraphList
with significant growth rates on according to data size... results in huge consumption in JSHeap.dispatch
is expensive due to the nature of immutability, results in huge execution time on data processing.Solutions
Turn Graph List Visibility Off
metadata.ids
andmetadata.groupEdge.fields
setup in #179 , we will use thenodeIds
,edgeIds
andgroupEdgeIds
to perform removal from thegraphFlatten
.Turn Graph List Visibility On
metadata.ids
andmetadata.groupEdge.fields
setup in #179 , we will use thenodeIds
,edgeIds
andgroupEdgeIds
to perform insertion into thegraphFlatten
.