On Fri, June 19, 2009 09:37, David Schmitt wrote: > > Brice Figureau wrote: >> >> On Wed, June 17, 2009 11:53, Thomas Bellman wrote: >>> Brice Figureau wrote: >>> >>>> I've almost finished node matching, even though I'm not really >>>> satisfied >>>> of how it works. Node matching is O(1) for the moment, but as soon as >>>> you >>>> add regexp in the mix, it becomes essentially O(n) :-( >>> I suppose Puppet currently builds a hash table of the node entries when >>> it compiles the manifests? You could then still keep the hash table >>> for >>> node statements with fixed, non-regexp, names, and try a lookup in that >>> table first for nodenames, and only check the list of regexps if the >>> hash >>> lookup fails. Then you only incur the O(n) penalty if you actually use >>> regexp node statements. And most sites will probably only have a few >>> such statements (even if they match many, many, hosts), so I think it >>> won't be a large practical problem. >> >> Yes, that's how I designed it. Still as soon one node uses a regex, you >> incur the O(n) penalty. > > And presumably, this is O(n) in the number of regexes? Which should be a > pretty low number for many reasonable setups.
Yes. Actually it is O(kn) where n is the number of regex nodes defined, and k the constant number of names of the connecting node (usually there are several names, including the hostname, the fqdn and the certname which might be different). -- Brice Figureau Days of Wonder --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To post to this group, send email to puppet-dev@googlegroups.com To unsubscribe from this group, send email to puppet-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en -~----------~----~----~----~------~----~------~--~---