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.
If checking whether something is already a member of a Set in Ruby is closer to O(1) than the O(N) that we have now, that certainly meets the criteria. I haven't dug into the implementation of Set in Ruby yet to see. This is mostly something the Coremunity team noticed while reviewing nearby code, and we opened the ticket to make sure that there was a reminder that there was something to follow up on. There wasn't a specific implementation in mind other than "not the one we're using now" when opening this ticket.