Forum Discussion
simple if statements optimized to switch statements ?
I'm surprised it's more optimal to evaluate an expression each time rather storing the result in a variable
The thing is, you're not performing an evaluation with these protocol commands (ie. [HTTP::path]). The information is already stored in the state table for this request, so [HTTP::path] is itself a variable, more or less.
in EXAMPLE 2 , because two comparisons are performed you'd prefer a switch over an if ?
You can really go either way with 1 to 10 comparisons, but I think anything more than that just turns into confusing code. It's a matter of preference more than performance.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com