Skip to content

(PUP-1592) Speed up loading of user defined types by 2x#2373

Merged
hlindberg merged 1 commit intopuppetlabs:masterfrom
hlindberg:pup-1592_avoid-type-search
Feb 21, 2014
Merged

(PUP-1592) Speed up loading of user defined types by 2x#2373
hlindberg merged 1 commit intopuppetlabs:masterfrom
hlindberg:pup-1592_avoid-type-search

Conversation

@hlindberg
Copy link
Contributor

When a user defined type is loaded a check is always first made
to see if the name loads a resource type implemented in ruby. The
majority of loads are for non ruby types. The loading must be done with
higher precedence of ruby based resource type over user defined.

This optimization capitalizes on the fact that ruby resource types are
in a flat name space and thus their names can never contain '::'. The
optimization is done in metatype/manager.rb where now an attempt to load
from the type loader is avoided if the name contains a ':'.

This achieves a 2x speedup and generates less permanent garbage (all
user defined type names where internalized as symbols, never to be
gc'd).

When a user defined type is loaded a check is always first made
to see if the name loads a resource type implemented in ruby. The
majority of loads are for non ruby types. The loading must be done with
higher precedence of ruby based resource type over user defined.

This optimization capitalizes on the fact that ruby resource types are
in a flat name space and thus their names can never contain '::'. The
optimization is done in metatype/manager.rb where now an attempt to load
from the type loader is avoided if the name contains a ':'.

This achieves a 2x speedup and generates less permanent garbage (all
user defined type names where internalized as symbols, never to be
gc'd).
@puppetcla
Copy link

CLA signed by all contributors.

hlindberg added a commit that referenced this pull request Feb 21, 2014
(PUP-1592) Speed up loading of user defined types by 2x
@hlindberg hlindberg merged commit 1219a4a into puppetlabs:master Feb 21, 2014
@hlindberg hlindberg deleted the pup-1592_avoid-type-search branch February 21, 2014 01:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants