Skip to content
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

[Disco]: recommending on{event} instead of on-modifier #2009

Open
NullVoxPopuli opened this issue Feb 17, 2024 · 4 comments
Open

[Disco]: recommending on{event} instead of on-modifier #2009

NullVoxPopuli opened this issue Feb 17, 2024 · 4 comments

Comments

@NullVoxPopuli
Copy link
Contributor

Motivation: krausest/js-framework-benchmark#1608

It's idiomatic to use {{on}} for event listening, and {{on}} is the only way to have conditionally applied / dynamic event listeners, but for performance sensitive situations, we can do less by using the platform, and we don't need any cleanup behavior, so native onclick should be sufficient.

@lifeart
Copy link
Contributor

lifeart commented Feb 17, 2024

@bertdeblock
Copy link
Contributor

AFAIK, the {{on}} modifier was introduced as a better alternative to the on* properties => https://github.com/emberjs/rfcs/pull/471/files#diff-a1482043efff1d9e730b71a8ac6b323a1dedf4c0e3ac20f427944ccb1dbce355R38-R57

@NullVoxPopuli
Copy link
Contributor Author

NullVoxPopuli commented Feb 18, 2024

My research is showing better is debatable. In fact, specifically, situational (4-5 percent render speed improvement of using on*)

@lifeart
Copy link
Contributor

lifeart commented Feb 18, 2024

@NullVoxPopuli here is proof on ~10% perf boost if we don't use removeEventListener

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

No branches or pull requests

3 participants