Skip to content

PERF: Introduce lazyHash and update PluginOutlet calls to use it #32823

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
May 22, 2025

Conversation

davidtaylorhq
Copy link
Member

This is a more efficient version of {{hash, where the values are only evaluated when they're actually accessed

Also bumps @discourse/lint-configs, which now includes an ember-template-lint rule to ensure {{hash}} is not reintroduced

@github-actions github-actions bot added the chat PRs which include a change to Chat plugin label May 20, 2025
@davidtaylorhq davidtaylorhq force-pushed the lazy-hash branch 2 times, most recently from f0a8ea0 to 032231c Compare May 21, 2025 14:47
}

// Like ember's builtin hash helper, but instead of returning a reified object
// every time its referenced, it returns a static proxy object with auto-trackable keys.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// every time its referenced, it returns a static proxy object with auto-trackable keys.
// every time it's referenced, it returns a static proxy object with auto-trackable keys.

This is a more efficient version of `{{hash`, where the values are only evaluated when they're actually accessed
We don't actually need a proxy, since the set of keys on an internalHelper can never change
no need to set up the LazyHash object until something actually accesses it

(the most common case for PluginOutlet is for it to be unused)
@davidtaylorhq davidtaylorhq merged commit 9ead2e6 into main May 22, 2025
16 checks passed
@davidtaylorhq davidtaylorhq deleted the lazy-hash branch May 22, 2025 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chat PRs which include a change to Chat plugin
Development

Successfully merging this pull request may close these issues.

2 participants