Forum Discussion
Nov 11, 2013
iRule optimization : store string evaluation as boolean
Is there any advantage to storing the result of a string comparison as a boolean ?
set query_params_exist ( [HTTP::query] ne "" )
if (query_params_exist == 1) {
}
... somewhere else deep in log...
JRahm
Admin
Nov 12, 2013you will shave cycles (small, but every bit helps) by using if { $variable } instead of if { $variable == 1 }, but there is no benefit to setting a variable to a value already cached in memory like HTTP::query unless you are performing additional operations against that value multiple times, then it makes sense to set the variable.
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects