Paul_Michals_10
Jan 21, 2011Nimbostratus
"if" verses "elseif" - performance question
Hello F5 DevCentral,
This comming Sunday I am to perform some minor maintenance on some of our existing F5 BIG-IP Virtual Servers when I will be modifing their iRules.
The question I have is: is it beter, from a performance perspective, to use "elseif" statements instead of sequential "if" statements give that there is no default "else" no matter what way the iRule is written?
Here is (with actual information removed) the proposed iRule:
when HTTP_REQUEST {
if { [HTTP::uri] equals "/" } {
HTTP::redirect https://website.company.com/complicated_url
}
if { [matchclass [HTTP::uri] starts_with $::list1] } {
if { not [matchclass [IP::client_addr] equals $::internal_network] } {
reject
}
}
if { [matchclass [HTTP::uri] starts_with $::list2] } {
if { not (([matchclass [IP::client_addr] equals $::allowed_addressses])
or ([matchclass [IP::client_addr] equals $::internal_network])) } {
reject
}
}
}
Instead of the three outer "if"s would a set of "if", "elseif", "elseif" statements be faster?
Or are the diffferences insignificant?
Thanks in advance.