I have a situation that has puzzled me for weeks. I am running logic that does a bit of back and forth to and from the database for each time it is executed (about 20 times). The problem is that the same code works about half of the time. What could possibly be the reason for the difference in execution performance and how can I better shore that this problem is checked?
When a function responds the same way with the same results each time it is given the same input, it is called a deterministic function. For example, SquareRoot() is deterministic (or should be). When it responds with a different value or potentially different value each time it is called the same way, it is a non-deterministic function. For example, Now() is non-deterministic, it provides a different time value each time it is called.
Your program is non-deterministic. Examine your code for typical kinds of non-deterministic behavior. I.e., timers, resource leaks, network timeouts, etc., etc.
精彩评论