HomePhorge

(PUP-659) Optimize debugging calls
2d0d7333b632Unpublished

Unpublished Commit ยท Learn More

Repository Importing: This repository is still importing.

Description

(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).

Details

Provenance
Henrik Lindberg <henrik.lindberg@cloudsmith.com>Authored on
vanmeeuwenPushed on Jun 2 2015, 2:22 PM
Parents
rPU9531806a9d99: (maint) Remove overly complex code in resource/type/parent_type
Branches
Unknown
Tags
Unknown

Event Timeline

Henrik Lindberg <henrik.lindberg@cloudsmith.com> committed rPU2d0d7333b632: (PUP-659) Optimize debugging calls (authored by Henrik Lindberg <henrik.lindberg@cloudsmith.com>).Dec 8 2014, 10:57 PM