Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-9508

Puppet::Util::Warnings#maybe_log potentially very slow

    XMLWordPrintable

Details

    • Improvement
    • Status: Accepted
    • Normal
    • Resolution: Unresolved
    • None
    • None
    • None
    • Needs Assessment

    Description

      https://github.com/puppetlabs/puppet/blob/293b87447ff955bb4c866b5b0eda3a23e5901ff2/lib/puppet/util/warnings.rb#L23-L30

      Puppet::Util::Warnings#maybe_log stores the list of messages that it has logged from each class in an array, and uses Array#include? to see whether the message has already been seen. This has the potential to slow down significantly as the number of messages logged from a specific class increases.

      We should probably look into storing the set of previously seen messages in something with a lookup time closer to O(1) than the current O(N) scan through the array.

      Attachments

        Activity

          People

            Unassigned Unassigned
            jacob.helwig Jacob Helwig
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Zendesk Support