Conversation
|
Never use chaining with |
|
I remember coming over this function the first time in this blog post, which was published in July, 2014: "What the hell is Ember.K?". The description of what it is useful for in that blog post is summarized in these bullets:
So essentially, temorary code or hooks for subclasses. Is this still useful? Is the suggested change in this RFC an acceptable replacement for |
text/0000-deprecate-ember-k.md
Outdated
|
|
||
| While doable, any possible benefit in code size or allocations obtained by reusing | ||
| the exact same Function instance everywhere would be greatly smashed by the | ||
| overhead both in space and CPU cycles of importing it in AMD-transpiled modules. |
There was a problem hiding this comment.
This doesn't necessarily seem true. Using Ember.K through a large app is almost certainly fewer allocations that creating lots of one-off functions.
If there is a performance argument for this it should be better made and benchmarked, IMO. I don't think you need a performance argument for this RFC though.
There was a problem hiding this comment.
Code wise the transpiled output is bigger.
Perhaps I was overconfident that the overhead of adding one extra import (the more imports the more work this.reify() has to do to create the this.reified) will overcome function allocations without a proof, but I can run some benchmarks to check it.
There was a problem hiding this comment.
I've ran some benchmarks, importing with requireJS with two modules VS importing only one and creating the functions inline.
With 100k iterations the diference are despicable. Depending on the run on wins over the other (2.3s)
I'm going to remove the performance concern from the reasoning.
Byte-wise declaring the function inline is shorter unless you use Ember.K more than 3 times per per import.
|
|
||
| The second downside of reusing the same instance in many places is that if for | ||
| some reason the VM deoptimizes that function, that deoptimization is spreaded | ||
| across all the usages of `Ember.K`. |
There was a problem hiding this comment.
I've never seen this when profiling. Is it a real-world issue you've seen?
There was a problem hiding this comment.
...but is it a real-world thing? Or just an idea that it might sometimes be an issue?
I'd like to keep RFCs rigorous by including, as justification for a decision, things which we know to be true when possible. There are some constraints that are based on intuition (does this API feel good) and some that are analytic. Performance is almost always an analytic constraint we can understand and test.
I'm wary of an off comment by @rwjblue being cargo-culted into a learned fact. We should be careful in RFCs we don't perpetuate assumption.
|
I haven't used it in 3 years. Coupled with being trivial to reimplement where needed, 👍 for removal. |
|
I am 💯% fine with killing this. Let's also celebrate that we're having an RFC for deprecating a three line 'no-op' function 🎉 |
After some local benchmark, the performance differences are despicable one way or another. With 100k iterations depending on the run one approach wins over the other.
Update 0000-deprecate-ember-k.md
Update 0000-deprecate-ember-k.md
|
I have actually used it and still using it in a number of apps. Almost exclusively for noop default actions in components, in case the component consumer does not provide its own (closure) action, so I can safely do I can see different styles of guards against this, like inline (https://github.com/cibernox/ember-power-select/blob/master/addon/components/power-select.js#L324-L327) or using a utility function for that (https://github.com/offirgolan/ember-light-table/blob/master/addon/utils/call-action.js). I am happy to learn if that is not considered a good style for whatever reason, but until then just declaring the action as Redefining On that matters, is the function allocations vs. import overhead argument still valid if rollup.js style module inlining should eventually land in ember-cli? |
|
@simonihmig I ran some benchmarks with 100K imports/allocations and performance difference is negligible either way. I'm going to shift the tone of the RFC away of the performance topic because it's not a big deal either way, and focusing it on removing from the public API low level utility that is trivial to replace. |
I too use |
The performance argument isn't the only one that can be done for a deprecation. Ember has been trying to slowly prune unnecessary APIs from the core library, and this is a good candidate due to being a very small, easily replaceable API. You might have noticed how FastBoot, Engines and more are mostly being done outside the core library :D I'm currently trying to gather some data so we have an idea of its usage, and will post an update when possible. |
Opening this up for discussion with y'all :)
Obviously no, it's not the end of the world if we keep If this helps you feel better about the churn, there will be an ember-watson task to automatically remove usages of If this goes ahead, it will be a very smooth process. |
|
@cibernox Just to be clear, it's not only about modifying the existing code, it's also about learning a new way to do things. And again, I completely acknowledge this is a trivial change technically. IMO it's more about the casual user who doesn't follow all these RFCs, read every blog post, and isn't a full time ember dev. Sometimes they're project contracting folks, or backend guys floating to the frontend for a sprint. They try to use |
How do they come upon
That seems fine? There are still some improvements we could do to get the deprecation guides closer to the user. |
Just something that has already been learned. Either by looking at other parts of the application, or by looking at an addon's implementation or even seeing it via debugging through Ember. I'm just trying to highlight that when something new replaces something old, which is often the case with an evergreen framework like Ember, if there isn't a clear benefit it can feel it can just feel like churn. Additionally, ember-watson is great for refactoring, but that is only one consequence of change. Relearning / retraining is another important consideration. |
|
We'll run a search to see how widespread is the usage of |
Some quick thoughts:
Ya totally, to complement that there is an additional cost and that is the cost new users learning, etc. [edit] Sorry, I just realized my list may have come off not as intended. It was truly intended as a quick brain dump, not as a "long list to stop the discussion". My opinion though is likely obvious, hopefully my list provides insight as into why I would prefer to see this leave. |
|
|
||
| The second downside of reusing the same instance in many places is that if for | ||
| some reason the VM deoptimizes that function, that deoptimization is spreaded | ||
| across all the usages of `Ember.K`. |
There was a problem hiding this comment.
ya, if this happens. Large chunks of inlined code could be evicted, making many things sad. Although this risk does seem to continue to reduce as JITs get better, if we can avoid it I would recommend we do.
text/0000-deprecate-ember-k.md
Outdated
|
|
||
| # Transition Path | ||
|
|
||
| The obvious first step is to make sure Ember, Ember-data and other pieces of the |
There was a problem hiding this comment.
ember-data I believe has some use-cases.
There was a problem hiding this comment.
I have a PR pending which might not even be necessary, as @runspired goes through the codebase.
There was a problem hiding this comment.
A wild @runspired unleashed upon a codebase you say?
text/0000-deprecate-ember-k.md
Outdated
| derp.foo().bar().baz(); // O_o | ||
| ``` | ||
|
|
||
| # Transition Path |
There was a problem hiding this comment.
When do we plan to drop? 3.0 or..
There was a problem hiding this comment.
Yes, as any regular feature. Although it will not have a export path in ember-core/source, but it will be present in the bundled version until 3.0
Update 0000-deprecate-ember-k.md
text/0000-deprecate-ember-k.md
Outdated
| torii/tests/unit/services/popup-test.js: close: Ember.K | ||
| ``` | ||
|
|
||
| ## Addendum 2 - `Ember.K` usage via destructuring across published addons |
Update 0000-deprecate-ember-k.md
text/0000-deprecate-ember-k.md
Outdated
|
|
||
| While doable, the transpiled output is actually bigger then defining the functions | ||
| inline, specially with the ES6 shorthand method syntax, and the perf difference | ||
| of saving a few function allocations is despicable. |
There was a problem hiding this comment.
"despicable" means "deserving of hatred and contempt" - Perhaps you meant "debatable"?
There was a problem hiding this comment.
It's a false-friend word I suppose, I meant negligible. Fixing it
|
@locks I think you're requested changes are still blocking. @workmanw I'm surprised that you aren't convinced by the idea that We're always trying to balance support for current users with making the framework as attractive as possible for new users. 💯. Part of this is to have a multi-pronged approach for existing users:
You're definitely a contributor who surfs the cutting edge of Ember, and as such you likely perceive change to happen more rapidly than other users. I've worked as plenty of shops that have deprecations from Ember 2.2 they still haven't bothered to look at even as they upgrade to 2.10. Change is inevitable in software. If Ember doesn't improve, we all end up rewriting in something else anyway. The tradeoff our community strives for is constant improvement with as much process and tooling as possible to pick-your-own-pace. I want to address your concerns, but they also seem pretty vague. Perhaps there is another discussion we can have some time about ways to better the communication for deprecations, especially around their motivation. I think for sure we should expect the deprecation guide PR to explain motivation. In general I'd like to advance this RFC and go into FCP sometime this week. I've added it to the core team agenda for Friday, so it will be discussed then if no sooner. |
|
@mixonic I was just trying to add a little friction to this discussion because I think Following through this RFC, before my initial comment, it seemed to be about performance. Which in general is a great reason to remove cruft. But then it kind of shifted from being about performance to being about removing something that was a no-op. That's when I wanted to raise my hand and ask if it was even beneficial to do this given that it will create deprecation warnings throughout the ecosystem and could seem like churn to some.
Bahauaha. Too funny. I think it was more about the fact that it is already there, and it has been for a really long time, than it was about the value of it overall. My comments were not meant to be a last stand to save |
|
@cibernox Thanks for the final edits regarding @workmanw I think we're pretty aligned in our goals. Removing |
There are new users to Ember.js and new users to Our team has Ember.js code going back almost 4 years. Somewhere in history, there's sure to be sprinkles of If users new to |
|
As there have been no issues raised in the FCP period that this RFC does not address, we will consider it accepted. I've rebased the commits down and merged into master: rfc commit, merge commit, commit renaming the file. 🎉 Thank you for your input and discussion! 🎉 |
|
Would love to read the RFC but it looks like the link is broken |
|
@bstro the merged RFC is at https://github.com/emberjs/rfcs/blob/master/text/0178-deprecate-ember-k.md. |
Rendered