Issue #17820 has been updated by Josh Cooper.

Status changed from Unreviewed to Accepted
Affected Puppet version changed from 3.0.1 to 2.7.9

Per and Linus, thank you for your patch. It's frightening that something as 
benign as creating a hash could be so expensive. I'm guessing ruby does not 
grow its hash  I wonder where else we do this? 

This issue was introduced in commit 7002eff7e369d71b1c1bc4bf9b60ac2045dd1efc to 
eliminate linear searching when finding nearest ancestors for each eval 
generated resource. That code didn't work on ruby 1.8.5, and was changed in 
commit 737c2f66476b2379f2546150856ea1cd7fdde08a to how it is today. That code 
was first released in 2.7.9, so I've updated the affected version accordingly.

Btw, in your benchmark, how many files were being eval_generated? Were you 
recursing into directories? If so, how many levels deep? Even better, do you 
have a script to recreate your test environment?
----------------------------------------
Bug #17820: eval_generate is needlessly slow
https://projects.puppetlabs.com/issues/17820#change-77514

Author: Per Cederqvist
Status: Accepted
Priority: Normal
Assignee: 
Category: performance
Target version: 
Affected Puppet version: 2.7.9
Keywords: 
Branch: 


By changing a single line in eval_generate in lib/puppet/transaction.rb I 
managed to speed up "puppet agent --test" from 4494 to 593 seconds. The code 
should produce the same result, but avoids allocating so many hashes.

Here is the diff.  If you prefer, I can create a Git branch et c, but I hope it 
isn't necessary for such a simple fix.

I'm also attaching the output from two ruby-prof runs, in call graph format: 
before and after the change.

(593 seconds is still too much. I suspect I might be submitting a new bug 
report in the not too distant future. :-)  Still, this change should be a 
speedup for everybody, and it shouldn't hurt anybody.)


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to