The issue wasn't with your rule--it's down to a bug in parsing the iRule. The issue is described in SOL7988 (
Click here). I'm not sure why it would matter if you set the array to nothing and then unset it versus just unsetting it. Can you try logging the array size to see if the array isn't getting cleared? You could try replacing the {}s with ""s to avoid the bug from SOL7988 and use your original set/unset.
I've read on DC that the clock command used significant CPU cycles in pre-9.2 versions. I've never seen a CR for this though. There have been so many other fixes since 9.1.2 that it would make a lot of sense to upgrade to a more current, supported version. 9.3.x will be supported for one more year. 9.4.7 is fairly well burned in and is a sustaining version now.
Here are some other suggestions...
You can wrap the operands for expr in curly braces:
[expr $current_time - $::window] ->
[expr {$current_time - $::window}]
http://tmml.sourceforge.net/doc/tcl/expr.html
PERFORMANCE CONSIDERATIONS
Enclose expressions in braces for the best speed and the smallest storage requirements. This allows the Tcl bytecode compiler to generate the best code.
You could also consider not calculating a request ID or adding any specific info on the current request to the arrays until you determine whether the request will be allowed or not. This would cut down on resource usage (but might not provide as accurate of metrics as what you have now).
You can check this post for other performance related suggestions:
http://devcentral.f5.com/wiki/default.aspx/iRules/HowToWriteFastRules.html
Aaron