Skip to content

Defer instantiation for memoizable array items (Craft 4)#14104

Merged
brandonkelly merged 12 commits into4.6from
feature/defer-instantiation-v4
Jan 4, 2024
Merged

Defer instantiation for memoizable array items (Craft 4)#14104
brandonkelly merged 12 commits into4.6from
feature/defer-instantiation-v4

Conversation

@brandonkelly
Copy link
Copy Markdown
Member

Description

Adds a new $normalizer argument to craft\base\MemoizableArray’s constructor, which can be used to lazy-instantiate any items within it, once they’re actually requested by all() or firstWhere().

We’re now taking advantage of this everywhere we can, as an initial measure to reducing the number of things that need to get instantiated in any given request.

Related issues

@brandonkelly brandonkelly changed the title Defer instantiation for memoizable array items Defer instantiation for memoizable array items (Craft 4) Jan 4, 2024
@brandonkelly brandonkelly merged commit ca6efc8 into 4.6 Jan 4, 2024
@brandonkelly brandonkelly deleted the feature/defer-instantiation-v4 branch January 4, 2024 12:31
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.

1 participant