It's always faster to execute logic like this natively in the product. But, in this case, "faster" can just mean you are shaving a couple dozen milliseconds off the request which is negligible. The bigger question you should ask yourself for situations like this is "what is more manageable". If it won't change very often and you just want to set it and forget it, then use the Class profile. But, if you want to have more control and options for expanding it (ie. adding elses and else-ifs), then an iRule might work out best for you.
Cheers!
-Joe