puppetlabs/puppet — pull request #2341 by zaphod42 (2014-02-09 20:10:39+00:00)
Title: (PUP-751) Benchmark and optimize loading of defined types

This adds a benchmark scenario for defined types. It also includes some
optimizations that target this benchmark. Overall there is about a 19%
improvement for the benchmark.

Here is the breakdown of the speedups to this point on my machine:

Initial(bca4d4e):
> total: 7.520000 1.250000 8.770000 ( 8.789636)
> avg: 0.752000 0.125000 0.877000 ( 0.878964)

Prefer defined types(2617d61):
> total: 7.150000 1.170000 8.320000 ( 8.326319)
> avg: 0.715000 0.117000 0.832000 ( 0.832632)

Preserve environment(3f8e94c):
> total: 6.170000 0.860000 7.030000 ( 7.057820)
> avg: 0.617000 0.086000 0.703000 ( 0.705782)

I also tried to change the order of loading in
Puppet::Parser::Scope#find_resource_type to have it look for defined types
first, but that resulted in an overall slowdown:

> total: 6.740000 0.730000 7.470000 ( 7.476968)
> avg: 0.674000 0.073000 0.747000 ( 0.747697)