(PUP-659) Optimize debugging calls
This optimizes debugging calls by allowing it to be called
with a block. This optimization is good because many calls
to Puppet.debug needs interpolation of a long string. This
(and internal housekeeping in the debug method) can be
completely avoided if puppet is not running for debugging.
By changing a call like this:
Puppet.debug("This interpolates #{x} and #{y}")
to
Puppet.debug{"This interpolates #{x} and #{y}"}
Reduces the cost to 40% of the original and more if the string is
longer, or has more interpolation/method calls involved to get
the values via a getter etc.
A call to debug_once should be guarded with a check if Puppet is
debugging (one such change was made).