You can make it so it only takes seconds to load if you, as I and rossko57 have suggested break the calculations up. Essentially what you have is a O(N!) algorithm (N factorial or 1*2*3*4*â€¦*N) to check the types of all the arguments of each line of code. So that first line is something like 7! or over 5040 operations, just to check the types. And each of the type checks likely has hundreds or thousands of instructions so it really blows up in terms of processing. The last line is 9! which is 362880. Notice how just adding two operands to that last calculation took it from just over 5000 checks to over 350000 checks. Thatâ€™s over 405000 operations just to check the types are correct on those three lines of code.

Thatâ€™s why it blows up so easily. But if you broke it up into multiple lines of code with fewer operands you can reduce that by orders of magnitude.

```
val edw = [ t |
var denominator = 240.97 + t
var numerator = 17.502 + t
var exponent = numerator / denominator
var pow = Math.pow(Math.E, exponent)
return 6.112 * pow
]
val Number t2Var = t2.state as Number
val Number t1Var = t1.state as Number
val ed44 = edw.apply(t2Var)
val ew44 = edw.apply(t1Var)
val numeratora = 1 + .00115*ew44
val numeratorb = ed44-ew44
val numerator = edw44 - 0.6687451584 * numeratora * numeratorb
val div = numerator / ed44
h4.postUpdate(div * 100)
```

Now letâ€™s count up the type checking operations.

```
2! + 2! + 2! + 1! + 1! + 2! + 1! + 1! + 1! + 1! + 3! + 2! +4! + 2! + 2! = 50
```

By splitting the above into separate lines we took something that took well over 400k operations to check the types down to 50 operations. Thatâ€™s a 4 orders of magnitude reduction and will mean the difference between taking 8-10 minutes and less than a second to load.

In addition, it gives you more of a chance to log out and see the intermediate operations which could be logged for debugging when the calculation does work.

Finally, this rule will explode if t1 or t2 are not Numbers but are instead NULL or UNDEF or if they carry Units of Measurement. By breaking it up like this you now have one place (where the local variables t1Var and t2Var are defined) where you can check for that.

Note that changing the cron period does absolutely nothing to reduce the load caused by the rules as written. The problem occurs when the .rules file is loaded, not when it runs.