利用可能な在庫に応じて一部の製品の推奨価格を計算するこの関数がありますが、それが何をするかは重要ではありませんが、どういうわけか私のプログラムはそれなしで x10 のように高速に実行され、私は本当に混乱しており、なぜ遅いのかわかりません
Dim MinPrice As Double
Dim VAT = 1.1899999999999999
Dim margin1
Dim potherrule1 As String
Dim margin2
Dim potherrule2 As String
Dim margin3
Dim potherrule3 As String
Dim defaultmargin
If SupplierMargin IsNot Nothing Then
margin1 = SupplierMargin(0)
potherrule1 = SupplierPother(0)
margin2 = SupplierMargin(1)
potherrule2 = SupplierPother(1)
margin3 = SupplierMargin(2)
potherrule3 = SupplierPother(2)
defaultmargin = SupplierMargin(3)
End If
If IsDBNull(CurrentPother) Or (potherrule1 = "x" And potherrule2 = "x" And potherrule3 = "x") Then
MinPrice = Math.Round((oprice / (1 - defaultmargin)) * VAT, 2)
Return MinPrice
End If
If Not IsDBNull(CurrentPother) Then
If potherrule1 <> "x" Then
Dim v1 As Integer
Dim v2 As Integer
Dim rule As String = potherrule1
Dim parts() As String = rule.Split(New String() {" bis "}, StringSplitOptions.None)
v1 = Integer.Parse(parts(0))
v2 = Integer.Parse(parts(1))
If CurrentPother >= v1 And CurrentPother <= v2 Then
MinPrice = Math.Round((oprice / (1 - margin1)) * VAT, 2)
End If
Return MinPrice
ElseIf potherrule2 <> "x" Then
Dim v1 As Integer
Dim v2 As Integer
Dim rule As String = potherrule2
Dim parts() As String = rule.Split(New String() {" bis "}, StringSplitOptions.None)
v1 = Integer.Parse(parts(0))
v2 = Integer.Parse(parts(1))
If CurrentPother >= v1 And CurrentPother <= v2 Then
MinPrice = Math.Round((oprice / (1 - margin2)) * VAT, 2)
Return MinPrice
End If
ElseIf potherrule2 <> "x" Then
Dim v1 As Integer
Dim v2 As Integer
Dim rule As String = potherrule3
Dim parts() As String = rule.Split(New String() {" bis "}, StringSplitOptions.None)
v1 = Integer.Parse(parts(0))
v2 = Integer.Parse(parts(1))
If CurrentPother >= v1 And CurrentPother <= v2 Then
MinPrice = Math.Round((oprice / (1 - margin3)) * VAT, 2)
Return MinPrice
End If
Else
MinimumPriceWhenPother4IsDBnull(SupplierMargin, oprice)
End If
End If
この機能を高速化するための改善点をいくつか提案していただけますか?