Skip to content

Delay prop code generation #321

@joeldrapper

Description

@joeldrapper

Currently, Literal generates and evaluates code each time you define a property, which means it is O(n²).

This is not a big problem because it’s rare for an object to have more than a handful of properties. And Ruby is pretty fast. However, it would be much more efficient if we could do this only once after all properties have been specified.

Two options come to mind:

  1. Use the :end TracePoint and a patch to Class.new
  2. Use a pre-processor like strict_ivars

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions