Which method will work best? (Or is there no difference in matter?)

Which (if any) of the following will give the least performance result? Or is the difference so small that I should use the most readable?

On the same page, I noted three styles used by previous maintainers:

Method 1 :

If (strRqMethod = "Forum" or strRqMethod = "URL" or strRqMethod = "EditURL" or strRqMethod = "EditForum") Then
 ...
End If

Method 2 :

Select Case strRqMethod
 Case "Reply", "ReplyQuote", "TopicQuote"
  'This is the only case in this statement...'
  ...
End Select

Method 3 :

If InArray("Edit,EditTopic,Reply,ReplyQuote,Topic,TopicQuote",strRqMethod) Then
 ...
End If

.
.
.

'Elsewhere in the code'
function InArray(strArray,strValue)
 if strArray <> "" and strArray <> "0" then
  if (instr("," & strArray & "," ,"," & strValue & ",") > 0) then
   InArray = True
  else
   InArray = False
  end if
 else
  InArray = False
 end if
end function

Disconnecting from classic ASP / VBScript is not an option, so these comments should not bother to post.

+3
source share
4 answers

Well method 3 will obviously be worse than the other two.

1 2 . , VBScript , 1 strRqMethod , . Case 2 , , , .

2 , , , , .

+2

, , .

, , /.

+4

:
, ; , , , .

, , , ...

OR-ed, :

  • / ", , , OR-ed ( ). [] , .. . ( , AND-ed, , , , , evalation , , ).
  • - , , . , , , , .
+1

100.000 ( : lof of) , . , , , .

, - , , . , , , , . , , - , , , ( , , ).

0

Source: https://habr.com/ru/post/1731282/


All Articles