A Great Read - "Comparing iRule Control Statements"
http://devcentral.f5.com/Tutorials/...ments.aspx
It illustrates the different results you'll see using if/else, switch, switch -glob, and class with different list sizes.
He expands upon the "Ten Steps to iRules Optimization" tech tip, primarily the "Understand Control Statements" section.
http://devcentral.f5.com/Tutorials/...ation.aspx
From my experience, it's very easy to write if/else statements but they're obviously not the best for performance. Switch statements are easy to write, relatively easy to read, and perform very well. I find the class command to be the most interesting. Sometimes, lists are simply unavoidable due to quantity but for less than 10 items, a lot of users might use a switch statement instead. Personally, I use datagroups constantly because I like my iRules to be as short and easy-to-read as possible. Sure, this means having to look at several small datagroups to understand the functionality of a rule with which you're not familiar, but it's still been my favorite. I've found the "-value" option of "class search" to be extremely powerful as well.
What do you guys prefer and why?