Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-4702

Replace rgen model for the Puppet Type system with immutable classes

    XMLWordPrintable

Details

    • Improvement
    • Status: Closed
    • Normal
    • Resolution: Fixed
    • None
    • PUP 4.3.0
    • None
    • None
    • 3
    • Language 2015-06-10, Language 2015-06-24, Language 2015-07-08
    • Bug Fix
    • A refactoring was done of the puppet type system to make it use less memory and faster performing.

    Description

      Current status

      The current type system is modeled using RGEN. While RGEN is very flexible and declarative in its nature and was a good choice for a first implementation, it is also slow and inefficient in terms of memory usage in comparison to a more direct approach using handcrafted objects. Many RGEN methods are among the top ten when running profiling on the platform code.

      Why RGEN is a bad fit

      The Puppet type system has no need for mutable objects (in fact, changing the properties of a type could have serious consequences). Nor has it any need to ever traverse containing types. The type system would benefit greatly from using light-weight and singleton patterns since types are often complex and reuses the same default types in many places.

      An RGEN model consists of mutable objects with container references. Light-weight and singleton objects are hence impossible to create. Memory is wasted, immutability is lost, and deep-cloning is needed in many places to isolate changes from having bad side effects. This affects Puppet in a bad way since the type system plays a very central role.

      Proposed solution

      Replace the RGEN type system with plain ruby classes that are completely immutable. This can be done without changing API since the internals of the type system is a private API.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              thomas.hallgren Thomas Hallgren
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support