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?
You could run a test with two irules using each and checking the timing in the "tmsh show ltm rule" command. Hit each irule with apache bench 100k times and see what the timing looks like.
I would venture a guess that since they're both string comparison operators, they probably use the same code under the hood. "==" should be less efficient for strings since it has to deal with integers as well. Unless the iRule devs found some giant inefficiency within the TCL eq operator (Unlikely), it's probably just to make a more readable iRule.
As said by Dave, it is also my understanding that equal and eq are same. They are string operator. The comparison should be eq with ==. As == is a numeric operator. So when you compare using "eq" or "equal", there will be less cycle time, as it would treat both values as strings. But if compare using "=", there will be higher cycle time, as tcl would convert each string to integer.