Re: [webcomponents] defineElement should not cache lifecycle callbacks and prototype of a custom element class (#417)

> I apologize, I could be just not understanding this. The way I understand, the reason for perf optimization is to avoid making a [[Get]] just before every callback invocation. This would involve JS engine detecting when an object had change, and only doing a [[Get]] when both of the following is true:
>
> it's time invoke the callback
> the JS object that represents the element has changed.

No, we would always do [[Get]] before invoking the callback.

What I'm suggesting is that your respective JS engine detect when the shape of the custom element instance's properties or its prototype chain and their respective properties change.  When they do, you can check whether it's possible for the element to have `attributeChangedCallback` and other lifecycle callbacks.  You can then avoid enqueuing lifecycle callbacks when the answer is definite no.

---
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/417#issuecomment-193494138

Received on Monday, 7 March 2016 23:01:17 UTC