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

fix(engine): closes #515 by removing lazy init #517

Merged
merged 1 commit into from
Aug 17, 2018

Conversation

caridy
Copy link
Contributor

@caridy caridy commented Jul 18, 2018

Details

Removes the lazy initialization now that the circular dependencies are not longer an issue after the separation of framework from faux-shadow.

This fixes #515

Does this PR introduce a breaking change?

  • No

@@ -1,5 +1,5 @@
import { LightningElement, getHostShadowRoot } from "../../framework/html-element";
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this one still exhibit the circular issue, but changing the order fixes it for me.

Copy link
Member

Choose a reason for hiding this comment

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

I would like to talk about this. If the import order mater then we still have a circular dependency issue.

Copy link
Contributor

@ravijayaramappa ravijayaramappa Jul 18, 2018

Choose a reason for hiding this comment

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

Just a suggestion: We should use a tool(for example: https://github.com/pahen/madge) to generate a dependency graph of the modules and remove any cyclic dependencies.

@@ -399,58 +395,54 @@ const globalElmDescriptors: PropertyDescriptorMap = create(null, {
[PatchedFlag]: {}
});

let globalInitialization: any = () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

removing the method to just run the code directly during evaluation instead of lazily.

@caridy caridy added this to the 218 milestone Jul 18, 2018
@salesforce-best-lwc-internal
Copy link

Benchmark results

Base commit: 2fa7e37 | Target commit: 3d7767e

lwc-engine-benchmark

table-append-1k metric base(2fa7e37) target(3d7767e) trend
benchmark-table/append/1k duration 146.30 (± 4.50 ms) 139.50 (± 4.10 ms) 4.65% 👍
table-clear-1k metric base(2fa7e37) target(3d7767e) trend
benchmark-table/clear/1k duration 11.90 (± 0.50 ms) 11.25 (± 0.70 ms) 5.46% 👍
table-create-10k metric base(2fa7e37) target(3d7767e) trend
benchmark-table/create/10k duration 844.20 (± 5.90 ms) 836.20 (± 4.20 ms) 0.95% 👍
table-create-1k metric base(2fa7e37) target(3d7767e) trend
benchmark-table/create/1k duration 100.80 (± 1.70 ms) 99.90 (± 2.00 ms) 0.89% 👌
table-update-10th-1k metric base(2fa7e37) target(3d7767e) trend
benchmark-table/update-10th/1k duration 87.00 (± 5.60 ms) 82.20 (± 4.00 ms) 5.52% 👍
tablecmp-append-1k metric base(2fa7e37) target(3d7767e) trend
benchmark-table-component/append/1k duration 225.20 (± 5.10 ms) 221.35 (± 5.85 ms) 1.71% 👌
tablecmp-clear-1k metric base(2fa7e37) target(3d7767e) trend
benchmark-table-component/clear/1k duration 35.70 (± 1.70 ms) 36.20 (± 1.50 ms) -1.40% 👌
tablecmp-create-10k metric base(2fa7e37) target(3d7767e) trend
benchmark-table-component/create/10k duration 1525.40 (± 7.80 ms) 1498.70 (± 12.30 ms) 1.75% 👍
tablecmp-create-1k metric base(2fa7e37) target(3d7767e) trend
benchmark-table-component/create/1k duration 164.60 (± 4.40 ms) 170.20 (± 4.00 ms) -3.40% 👎
tablecmp-update-10th-1k metric base(2fa7e37) target(3d7767e) trend
benchmark-table-component/update-10th/1k duration 75.40 (± 5.00 ms) 76.50 (± 4.70 ms) -1.46% 👌
wc-append-1k metric base(2fa7e37) target(3d7767e) trend
benchmark-table-wc/append/1k duration 258.10 (± 6.60 ms) 253.00 (± 12.80 ms) 1.98% 👌
wc-clear-1k metric base(2fa7e37) target(3d7767e) trend
benchmark-table-wc/clear/1k duration 34.10 (± 1.00 ms) 34.00 (± 1.00 ms) 0.29% 👌
wc-create-10k metric base(2fa7e37) target(3d7767e) trend
benchmark-table-wc/create/10k duration 1969.70 (± 12.00 ms) 1933.20 (± 5.60 ms) 1.85% 👍
wc-create-1k metric base(2fa7e37) target(3d7767e) trend
benchmark-table-wc/create/1k duration 207.90 (± 4.10 ms) 209.10 (± 4.50 ms) -0.58% 👌
wc-update-10th-1k metric base(2fa7e37) target(3d7767e) trend
benchmark-table-wc/update-10th/1k duration 75.40 (± 3.40 ms) 74.20 (± 5.60 ms) 1.59% 👌

Copy link
Member

@pmdartus pmdartus left a comment

Choose a reason for hiding this comment

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

@@ -1,5 +1,5 @@
import { LightningElement, getHostShadowRoot } from "../../framework/html-element";
Copy link
Member

Choose a reason for hiding this comment

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

I would like to talk about this. If the import order mater then we still have a circular dependency issue.


if (process.env.NODE_ENV !== 'production') {
patchLightningElementPrototypeWithRestrictions(BaseElement.prototype);
forEach.call(ElementAOMPropertyNames, (propName: string) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

@caridy I assume there a reason for putting this in def.ts instead of html-element.ts

Copy link
Contributor Author

Choose a reason for hiding this comment

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

because this generates two sets, the set that goes into the component proto, and the set that goes into the element proto.

Copy link
Contributor

@ravijayaramappa ravijayaramappa left a comment

Choose a reason for hiding this comment

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

LGTM me from the LightningElement perspective 👍

@caridy
Copy link
Contributor Author

caridy commented Aug 15, 2018

@byao this is also ready for integration. @pmdartus has some ideas to remove the circular deps, but I think we can take care of that in another PR just for that. This is needed by locker in 218.

@caridy caridy force-pushed the caridy/fix-issue-515-lazy-initialization-locker branch from 3d7767e to a6e3aa7 Compare August 17, 2018 17:17
@salesforce-best-lwc-internal
Copy link

Benchmark results

Base commit: ce9308b | Target commit: a6e3aa7

lwc-engine-benchmark

table-append-1k metric base(ce9308b) target(a6e3aa7) trend
benchmark-table/append/1k duration 160.20 (± 4.50 ms) 155.80 (± 4.75 ms) 2.75% 👍
table-clear-1k metric base(ce9308b) target(a6e3aa7) trend
benchmark-table/clear/1k duration 12.70 (± 0.60 ms) 12.10 (± 0.70 ms) 4.72% 👍
table-create-10k metric base(ce9308b) target(a6e3aa7) trend
benchmark-table/create/10k duration 892.30 (± 8.20 ms) 886.30 (± 5.10 ms) 0.67% 👍
table-create-1k metric base(ce9308b) target(a6e3aa7) trend
benchmark-table/create/1k duration 108.30 (± 2.20 ms) 106.80 (± 1.70 ms) 1.39% 👍
table-update-10th-1k metric base(ce9308b) target(a6e3aa7) trend
benchmark-table/update-10th/1k duration 86.00 (± 2.10 ms) 88.20 (± 3.90 ms) -2.56% 👎
tablecmp-append-1k metric base(ce9308b) target(a6e3aa7) trend
benchmark-table-component/append/1k duration 239.20 (± 5.50 ms) 238.10 (± 5.10 ms) 0.46% 👌
tablecmp-clear-1k metric base(ce9308b) target(a6e3aa7) trend
benchmark-table-component/clear/1k duration 36.20 (± 1.80 ms) 37.00 (± 1.60 ms) -2.21% 👎
tablecmp-create-10k metric base(ce9308b) target(a6e3aa7) trend
benchmark-table-component/create/10k duration 1598.80 (± 10.90 ms) 1612.50 (± 8.60 ms) -0.86% 👎
tablecmp-create-1k metric base(ce9308b) target(a6e3aa7) trend
benchmark-table-component/create/1k duration 176.00 (± 4.20 ms) 178.10 (± 3.80 ms) -1.19% 👌
tablecmp-update-10th-1k metric base(ce9308b) target(a6e3aa7) trend
benchmark-table-component/update-10th/1k duration 78.85 (± 3.60 ms) 80.75 (± 4.30 ms) -2.41% 👌
wc-append-1k metric base(ce9308b) target(a6e3aa7) trend
benchmark-table-wc/append/1k duration 274.20 (± 6.90 ms) 274.10 (± 7.80 ms) 0.04% 👌
wc-clear-1k metric base(ce9308b) target(a6e3aa7) trend
benchmark-table-wc/clear/1k duration 35.80 (± 1.20 ms) 36.20 (± 1.10 ms) -1.12% 👌
wc-create-10k metric base(ce9308b) target(a6e3aa7) trend
benchmark-table-wc/create/10k duration 2026.80 (± 7.80 ms) 2071.90 (± 10.10 ms) -2.23% 👎
wc-create-1k metric base(ce9308b) target(a6e3aa7) trend
benchmark-table-wc/create/1k duration 222.70 (± 4.70 ms) 222.90 (± 4.40 ms) -0.09% 👌
wc-update-10th-1k metric base(ce9308b) target(a6e3aa7) trend
benchmark-table-wc/update-10th/1k duration 79.20 (± 3.90 ms) 79.60 (± 4.00 ms) -0.51% 👌

@ekashida ekashida merged commit 38fe207 into master Aug 17, 2018
@ekashida ekashida deleted the caridy/fix-issue-515-lazy-initialization-locker branch August 17, 2018 17:39
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.

[Locker] Properties created lazily on LightningElement are not skipped by Locker
4 participants