perf(execution): reuse component UID within each snapshot read
This commit is contained in:
1 parent
13b9ff48dd
commit
5b625b076e
2 files changed
+75
-13
No files matched your search
@@ -459,8 +459,8 @@ Sub QPEnsureComponentIndex()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Function QPComponentPins(ByRef Comp)
|
||||
Dim Context, LocalIndex, AllPins, CmpPin, Owner, Bucket, Count, ComponentUid
|
||||
Function QPComponentPins(ByVal ComponentUid)
|
||||
Dim Context, LocalIndex, AllPins, CmpPin, Owner, Bucket, Count
|
||||
Context = QPCanonicalPath(QPProjectPath()) & "|" & QPSheetIdentity()
|
||||
If Not IsObject(QP_PinIndex) Then Set QP_PinIndex = Nothing
|
||||
If Not QP_PinIndex Is Nothing Then
|
||||
@@ -490,7 +490,6 @@ Function QPComponentPins(ByRef Comp)
|
||||
QPLog QP_Root, "INFO", "pin_index_built count=" & Count
|
||||
QPProgress "index_pins", Count, Count
|
||||
End If
|
||||
ComponentUid = CStr(Comp.UID)
|
||||
If QP_PinIndex.Exists(ComponentUid) Then
|
||||
Set QPComponentPins = QP_PinIndex.Item(ComponentUid)
|
||||
Else
|
||||
@@ -1258,13 +1257,13 @@ Function QPUntouchedFullState(ByRef Comp)
|
||||
Dim Point, Pins, Connections, Attr, AttributeText, Result, Uid
|
||||
Uid = CStr(Comp.UID)
|
||||
Set Point = Comp.GetLocation()
|
||||
Set Pins = QPComponentPins(Comp)
|
||||
Set Pins = QPComponentPins(Uid)
|
||||
If Pins.Count = 0 Then
|
||||
' A genuinely empty query is valid for annotation symbols; COM errors
|
||||
' still propagate. Selected replacement symbols continue to require pins.
|
||||
Connections = "NO_PINS"
|
||||
Else
|
||||
Connections = QPConnectionSignatureFromPins(Comp, Pins)
|
||||
Connections = QPConnectionSignatureFromPins(Uid, Pins)
|
||||
End If
|
||||
Result = "C" & vbTab & QPEncode(Uid) & vbTab & QPEncode(CStr(Comp.Refdes)) & _
|
||||
vbTab & QPEncode(CStr(Point.X)) & vbTab & QPEncode(CStr(Point.Y)) & _
|
||||
@@ -1363,10 +1362,13 @@ Function QPSnapshotComponent(ByRef Comp)
|
||||
Dim ErrorNumber
|
||||
Dim ErrorSource
|
||||
Dim ErrorDescription
|
||||
Dim Uid, Pins
|
||||
|
||||
Uid = CStr(Comp.UID)
|
||||
Set Point = Comp.GetLocation()
|
||||
Connections = QPConnectionSignature(Comp)
|
||||
Result = "C" & vbTab & QPEncode(CStr(Comp.UID)) & vbTab & _
|
||||
Set Pins = QPComponentPins(Uid)
|
||||
Connections = QPConnectionSignatureFromPins(Uid, Pins)
|
||||
Result = "C" & vbTab & QPEncode(Uid) & vbTab & _
|
||||
QPEncode(CStr(Comp.Refdes)) & vbTab & QPEncode(CStr(Point.X)) & _
|
||||
vbTab & QPEncode(CStr(Point.Y)) & vbTab & _
|
||||
QPEncode(CStr(Comp.Orientation)) & vbTab & QPEncode(CStr(Comp.Scale)) & _
|
||||
@@ -1377,7 +1379,7 @@ Function QPSnapshotComponent(ByRef Comp)
|
||||
AttributeText = ""
|
||||
AttributeCount = 0
|
||||
For Each Attr In Comp.Attributes
|
||||
AttributeText = AttributeText & QPSnapshotAttribute(CStr(Comp.UID), Attr)
|
||||
AttributeText = AttributeText & QPSnapshotAttribute(Uid, Attr)
|
||||
If Err.Number <> 0 Then Exit For
|
||||
AttributeCount = AttributeCount + 1
|
||||
QPProgress "snapshot_attributes", AttributeCount, 0
|
||||
@@ -2484,12 +2486,13 @@ Function QPEffectiveAttributeValue(ByRef Attr)
|
||||
End Function
|
||||
|
||||
Function QPConnectionSignature(ByRef Comp)
|
||||
Dim Pins
|
||||
Set Pins = QPComponentPins(Comp)
|
||||
QPConnectionSignature = QPConnectionSignatureFromPins(Comp, Pins)
|
||||
Dim Pins, Uid
|
||||
Uid = CStr(Comp.UID)
|
||||
Set Pins = QPComponentPins(Uid)
|
||||
QPConnectionSignature = QPConnectionSignatureFromPins(Uid, Pins)
|
||||
End Function
|
||||
|
||||
Function QPConnectionSignatureFromPins(ByRef Comp, ByRef Pins)
|
||||
Function QPConnectionSignatureFromPins(ByVal ComponentUid, ByRef Pins)
|
||||
Dim PinIndexKey
|
||||
Dim PinReadCount
|
||||
Dim CmpPin
|
||||
@@ -2513,7 +2516,7 @@ Function QPConnectionSignatureFromPins(ByRef Comp, ByRef Pins)
|
||||
PinReadCount = 0
|
||||
For Each PinIndexKey In Pins.Keys
|
||||
Set CmpPin = Pins.Item(CStr(PinIndexKey))
|
||||
If StrComp(CStr(CmpPin.Component.UID), CStr(Comp.UID), _
|
||||
If StrComp(CStr(CmpPin.Component.UID), ComponentUid, _
|
||||
vbBinaryCompare) = 0 Then
|
||||
Set Point = CmpPin.GetLocation()
|
||||
PinKey = CStr(CmpPin.Number) & "|" & CStr(Point.X) & "|" & _
|
||||
|
||||
Reference in new issue
Block a user