HomePhorge

type: support implicit "identity" transformation
89e0f142044eUnpublished

Unpublished Commit ยท Learn More

Repository Importing: This repository is still importing.

Description

type: support implicit "identity" transformation

Almost every implementation of title_patterns on a type returned with a
lambda that performed an "identity" transformation - lambda {|x| x }.

That actually cost a notable amount of memory allocation, because it created a
new instance of the lambda on every invocation. That represented about three
percent of total memory allocation, or 8MB total.

This allows the title_patterns data to simply omit the lambda - if you don't
supply one, we don't invoke it to transform the result, just assign directly.

This allows everyone to keep using this the way they currently do, including
supplying an identity lambda if they want, but allows internal types and types
that don't override the default to be more memory efficient.

Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>

Details

Provenance
Daniel Pittman <daniel@puppetlabs.com>Authored on
vanmeeuwenPushed on Jun 2 2015, 2:22 PM
Parents
rPU397dfa8fc9da: monkey_patch: cache Symbol to_proc result.
Branches
Unknown
Tags
Unknown

Event Timeline

Daniel Pittman <daniel@puppetlabs.com> committed rPU89e0f142044e: type: support implicit "identity" transformation (authored by Daniel Pittman <daniel@puppetlabs.com>).Sep 18 2012, 2:55 AM