Forum Discussion
JRahm
May 08, 2009Admin
Optimize This! iRule Contest
Hey there iRulers!
I'm opening up a little optimization contest. For background on this iRule, check out Lori's blog (Click here) and my follow up (Click here)
I only optimized the variable reduction, I'm sure there are more options, however, so here's the challenge: the most efficient iRule in terms of avg CPU cycles wins. The winner will get some cool swag and a blog post featuring the winning iRule. Some guidelines:
1) The rule must work
2) The rule must provide like functionality
3) The rule must be provided in its entirety as a post in this thread no later than 5pm PDT 5/15/2009. No exceptions!
I will test all the rules on my lab box, which is currently running v10 hotfix 2. I'll announce the winner the following week.
Sound good? Can't wait for your entries...Jason
Here's Lori's original iRule:
when HTTP_REQUEST timing on {
set uri [HTTP::uri]
if {$uri starts_with "/roll"} {
set v1 [URI::query [HTTP::uri] "num"]
set v2 [URI::query [HTTP::uri] "d"]
set total 0
for {set i 0} { $i < $v1} {incr i} {
set dieroll [expr {int(rand()*$v2) + 1}]
set result1 [expr {round($dieroll)}]
set total [expr {$total + $result1}]
}
HTTP::respond 200 content "$v1 d $v2 = $total"
}
}
4 Replies
Sort By
- how about this one...
- Excellent first entry! Thanks, natty76! Surely there are some other takers out there?
- C'mon, community! You have 24 hours... natty76 can't win by default!
- So...I guess I don't have much evaluation to do on this front...congrats natty76! I'll get a blog post up later today.
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