Forum Discussion
Chris_Miller
Altostratus
Aug 20, 2010Most efficient way to log?
HTTP::cookie insert name "test" value [class search -value test eq [IP::server_addr]] path /
log local0. "inserting cookie for test [class search -value test eq [IP::server_addr]] since server was [IP::server_addr]"
or
set test [class search -value test eq [IP::server_addr]]
HTTP::cookie insert name "test" value $test path /
log local0. "inserting cookie for test $test since server was [IP::server_addr]"
I know I can use "timing" to find out but am curious whether there's hard and fast rules as to when it's useful to set a variable vs doing multiple data group comparisons, etc.- L4L7_53191
Nimbostratus
Chris: I think avoiding the variable is the way to go. The obvious downside is readability, obviously. - JRahm
Admin
In this instance Chris, the variable is almost certainy the way to go, particularly as your class sizes grow. This is why testing is so important. Sometimes the use of variable IS the optimized approach, though often it is not.
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