Cool idea, if a bit extreme.
If computing a value is expensive, there's Memoize for the caller. On the callee side, you can cache the result (there's state variable in 5.10+ so it's dead simple to use).
So I believe Sub::StopCalls is only necessary if you find the overhead of the sub call itself to be a bottleneck. And if that is the case, perhaps you should refactor the calling code anyway.
1 out of 2 found this review helpful. Was this review helpful to you? Yes No