LoveNoodles
Feb 02, 2019Altocumulus
equals vs eq?
Hi, is there any documentation or articles out there that suggest using "equals" is more efficient than using "eq" in string comparisons in irules?
It's worth noting that 'equals' is an iRule extension to TCL, whereas 'eq' is native TCL. Most iRule extensions such as 'starts_with' 'contains' 'not' etc have been added to make code easier to read.
Details of iRule operator expressions can be found in the Wiki https://devcentral.f5.com/wiki/iRules.Operators.ashx
Jason Rahm wrote an article a couple of months ago: Choose Your Operator Wisely
In it he compares 'starts_with' (iRule extension) and string match (native TCL). The native TCL command resulted in a 4.6% CPU saving.
I would probably always lean towards native TCL commands being quicker as anything else has been added on top - That said, like other answers have suggested, using the timing feature may help gauge a more accurate answer.