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

feat(engine): inline styles to support native shadow #540

Merged
merged 6 commits into from Oct 11, 2018

Conversation

caridy
Copy link
Contributor

@caridy caridy commented Jul 26, 2018

Details

  • template.style can be a function that when invoked, returns the inline style
  • style element is always the first element in the shadow if the rendered template has style property
  • the style tag is empty when in fallback mode to guarantee the position of the elements.

This is PR is compatible with the existing compilation, it supports both mechanism. Eventually, once the compiler updates, we can remove the forking logic in tests and update template.ts to always rely on the style function instead of the template to extract tokens.

Does this PR introduce a breaking change?

  • No

@caridy caridy requested a review from pmdartus July 26, 2018 17:31
@salesforce-best-lwc-internal
Copy link

Benchmark results

Base commit: a134943 | Target commit: 556ee02

lwc-engine-benchmark

table-append-1k metric base(a134943) target(556ee02) trend
benchmark-table/append/1k duration 146.10 (± 4.20 ms) 150.60 (± 4.00 ms) -3.08% 👎
table-clear-1k metric base(a134943) target(556ee02) trend
benchmark-table/clear/1k duration 12.00 (± 0.60 ms) 12.50 (± 0.50 ms) -4.17% 👎
table-create-10k metric base(a134943) target(556ee02) trend
benchmark-table/create/10k duration 849.00 (± 3.80 ms) 847.40 (± 5.00 ms) 0.19% 👌
table-create-1k metric base(a134943) target(556ee02) trend
benchmark-table/create/1k duration 100.00 (± 2.00 ms) 101.80 (± 2.20 ms) -1.80% 👎
table-update-10th-1k metric base(a134943) target(556ee02) trend
benchmark-table/update-10th/1k duration 89.50 (± 3.70 ms) 89.60 (± 5.10 ms) -0.11% 👌
tablecmp-append-1k metric base(a134943) target(556ee02) trend
benchmark-table-component/append/1k duration 223.30 (± 5.00 ms) 196.60 (± 8.10 ms) 11.96% 👍
tablecmp-clear-1k metric base(a134943) target(556ee02) trend
benchmark-table-component/clear/1k duration 35.30 (± 1.60 ms) 35.60 (± 1.30 ms) -0.85% 👌
tablecmp-create-10k metric base(a134943) target(556ee02) trend
benchmark-table-component/create/10k duration 1515.80 (± 9.20 ms) 1575.60 (± 12.00 ms) -3.95% 👎
tablecmp-create-1k metric base(a134943) target(556ee02) trend
benchmark-table-component/create/1k duration 167.90 (± 3.70 ms) 172.90 (± 3.30 ms) -2.98% 👎
tablecmp-update-10th-1k metric base(a134943) target(556ee02) trend
benchmark-table-component/update-10th/1k duration 76.10 (± 4.20 ms) 77.40 (± 4.20 ms) -1.71% 👌
wc-append-1k metric base(a134943) target(556ee02) trend
benchmark-table-wc/append/1k duration 251.20 (± 14.00 ms) 272.10 (± 4.80 ms) -8.32% 👎
wc-clear-1k metric base(a134943) target(556ee02) trend
benchmark-table-wc/clear/1k duration 36.10 (± 1.20 ms) 36.70 (± 1.00 ms) -1.66% 👎
wc-create-10k metric base(a134943) target(556ee02) trend
benchmark-table-wc/create/10k duration 1990.30 (± 10.10 ms) 1984.50 (± 9.90 ms) 0.29% 👍
wc-create-1k metric base(a134943) target(556ee02) trend
benchmark-table-wc/create/1k duration 212.20 (± 3.90 ms) 213.20 (± 4.15 ms) -0.47% 👌
wc-update-10th-1k metric base(a134943) target(556ee02) trend
benchmark-table-wc/update-10th/1k duration 75.65 (± 4.50 ms) 78.00 (± 5.30 ms) -3.11% 👌

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

Benchmark results

Base commit: 751904b | Target commit: d3ed20f

lwc-engine-benchmark

table-append-1k metric base(751904b) target(d3ed20f) trend
benchmark-table/append/1k duration 146.60 (± 3.80 ms) 145.20 (± 5.40 ms) 0.95% 👌
table-clear-1k metric base(751904b) target(d3ed20f) trend
benchmark-table/clear/1k duration 11.50 (± 0.60 ms) 11.90 (± 0.70 ms) -3.48% 👎
table-create-10k metric base(751904b) target(d3ed20f) trend
benchmark-table/create/10k duration 841.80 (± 5.20 ms) 845.00 (± 4.50 ms) -0.38% 👎
table-create-1k metric base(751904b) target(d3ed20f) trend
benchmark-table/create/1k duration 101.70 (± 1.90 ms) 102.20 (± 1.90 ms) -0.49% 👌
table-update-10th-1k metric base(751904b) target(d3ed20f) trend
benchmark-table/update-10th/1k duration 85.95 (± 5.20 ms) 85.70 (± 4.00 ms) 0.29% 👌
tablecmp-append-1k metric base(751904b) target(d3ed20f) trend
benchmark-table-component/append/1k duration 224.00 (± 4.60 ms) 227.50 (± 7.50 ms) -1.56% 👎
tablecmp-clear-1k metric base(751904b) target(d3ed20f) trend
benchmark-table-component/clear/1k duration 35.70 (± 1.80 ms) 35.90 (± 1.20 ms) -0.56% 👌
tablecmp-create-10k metric base(751904b) target(d3ed20f) trend
benchmark-table-component/create/10k duration 1532.90 (± 11.10 ms) 1645.60 (± 10.50 ms) -7.35% 👎
tablecmp-create-1k metric base(751904b) target(d3ed20f) trend
benchmark-table-component/create/1k duration 173.50 (± 4.70 ms) 171.50 (± 4.40 ms) 1.15% 👌
tablecmp-update-10th-1k metric base(751904b) target(d3ed20f) trend
benchmark-table-component/update-10th/1k duration 76.70 (± 3.40 ms) 78.50 (± 3.80 ms) -2.35% 👌
wc-append-1k metric base(751904b) target(d3ed20f) trend
benchmark-table-wc/append/1k duration 258.00 (± 13.00 ms) 262.10 (± 8.60 ms) -1.59% 👌
wc-clear-1k metric base(751904b) target(d3ed20f) trend
benchmark-table-wc/clear/1k duration 36.40 (± 1.55 ms) 36.30 (± 1.60 ms) 0.27% 👌
wc-create-10k metric base(751904b) target(d3ed20f) trend
benchmark-table-wc/create/10k duration 1982.00 (± 10.20 ms) 2017.00 (± 7.80 ms) -1.77% 👎
wc-create-1k metric base(751904b) target(d3ed20f) trend
benchmark-table-wc/create/1k duration 210.60 (± 4.10 ms) 213.00 (± 5.00 ms) -1.14% 👎
wc-update-10th-1k metric base(751904b) target(d3ed20f) trend
benchmark-table-wc/update-10th/1k duration 74.10 (± 3.70 ms) 74.70 (± 3.40 ms) -0.81% 👌

@caridy
Copy link
Contributor Author

caridy commented Jul 30, 2018

@pmdartus this is now ready to roll! you can base your branch for compiler off this branch.

@caridy
Copy link
Contributor Author

caridy commented Aug 15, 2018

@byao this should be continue at some point. I know @pmdartus is busy with the CSS stuff, but eventually we need either him, or someone else to take this on, this is important for off-core dev.

} else {
// native shadow in place, we need to act accordingly by using the `:host`
// selector, and an empty shadow selector since it is not really needed
const textContent = style(':host', '');
Copy link
Member

Choose a reason for hiding this comment

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

After working #637, replacing the token there will not work. We need to duplicate the CSS rule to make this work.

// Original
:host(.active) {}

// Transformed
[host-token].active {}

// With the :host replace at runtime
:host.active {}

@salesforce-best-lwc-internal
Copy link

Benchmark results

Base commit: 88f3dcd | Target commit: 72e9618

lwc-engine-benchmark

table-append-1k metric base(88f3dcd) target(72e9618) trend
benchmark-table/append/1k duration 164.85 (±3.60 ms) 156.00 (±4.40 ms) -8.9ms (5.4%) 👍
table-clear-1k metric base(88f3dcd) target(72e9618) trend
benchmark-table/clear/1k duration 12.95 (±0.90 ms) 12.40 (±0.70 ms) -0.5ms (4.2%) 👍
table-create-10k metric base(88f3dcd) target(72e9618) trend
benchmark-table/create/10k duration 933.35 (±8.60 ms) 933.50 (±8.45 ms) +0.1ms (0.0%) 👌
table-create-1k metric base(88f3dcd) target(72e9618) trend
benchmark-table/create/1k duration 111.40 (±2.40 ms) 110.05 (±2.10 ms) -1.4ms (1.2%) 👍
table-update-10th-1k metric base(88f3dcd) target(72e9618) trend
benchmark-table/update-10th/1k duration 84.95 (±1.55 ms) 97.75 (±3.60 ms) +12.8ms (15.1%) 👎
tablecmp-append-1k metric base(88f3dcd) target(72e9618) trend
benchmark-table-component/append/1k duration 236.90 (±6.35 ms) 206.05 (±6.70 ms) -30.8ms (13.0%) 👍
tablecmp-clear-1k metric base(88f3dcd) target(72e9618) trend
benchmark-table-component/clear/1k duration 20.35 (±1.95 ms) 19.50 (±2.60 ms) -0.9ms (4.2%) 👌
tablecmp-create-10k metric base(88f3dcd) target(72e9618) trend
benchmark-table-component/create/10k duration 1700.40 (±15.75 ms) 1745.00 (±15.70 ms) +44.6ms (2.6%) 👎
tablecmp-create-1k metric base(88f3dcd) target(72e9618) trend
benchmark-table-component/create/1k duration 191.05 (±5.25 ms) 188.65 (±4.70 ms) -2.4ms (1.3%) 👌
tablecmp-update-10th-1k metric base(88f3dcd) target(72e9618) trend
benchmark-table-component/update-10th/1k duration 84.05 (±4.95 ms) 82.60 (±5.80 ms) -1.5ms (1.7%) 👌
wc-append-1k metric base(88f3dcd) target(72e9618) trend
benchmark-table-wc/append/1k duration 272.85 (±17.60 ms) 276.85 (±14.60 ms) +4.0ms (1.5%) 👌
wc-clear-1k metric base(88f3dcd) target(72e9618) trend
benchmark-table-wc/clear/1k duration 30.40 (±1.80 ms) 29.30 (±2.70 ms) -1.1ms (3.6%) 👌
wc-create-10k metric base(88f3dcd) target(72e9618) trend
benchmark-table-wc/create/10k duration 2152.85 (±14.20 ms) 2182.40 (±12.25 ms) +29.6ms (1.4%) 👎
wc-create-1k metric base(88f3dcd) target(72e9618) trend
benchmark-table-wc/create/1k duration 222.80 (±6.15 ms) 224.40 (±5.65 ms) +1.6ms (0.7%) 👌
wc-update-10th-1k metric base(88f3dcd) target(72e9618) trend
benchmark-table-wc/update-10th/1k duration 83.65 (±6.10 ms) 84.25 (±5.40 ms) +0.6ms (0.7%) 👌

@pmdartus pmdartus changed the title refactor(engine): inline styles to support native shadow feat(engine): inline styles to support native shadow Sep 30, 2018
@salesforce-best-lwc-internal
Copy link

Benchmark results

Base commit: ae82aa7 | Target commit: 7576413

lwc-engine-benchmark-ie11

table-append-1k metric base(ae82aa7) target(7576413) trend
benchmark-table/append/1k duration 778.60 (±0.00 ms) 802.70 (±0.00 ms) +24.1ms (3.1%) 👌
table-clear-1k metric base(ae82aa7) target(7576413) trend
benchmark-table/clear/1k duration 76.10 (±0.00 ms) 77.30 (±0.00 ms) +1.2ms (1.6%) 👌
table-create-10k metric base(ae82aa7) target(7576413) trend
benchmark-table/create/10k duration 7343.20 (±0.00 ms) 7621.70 (±0.00 ms) +278.5ms (3.8%) 👌
table-create-1k metric base(ae82aa7) target(7576413) trend
benchmark-table/create/1k duration 720.40 (±0.00 ms) 672.90 (±0.00 ms) -47.5ms (6.6%) 👌
table-update-10th-1k metric base(ae82aa7) target(7576413) trend
benchmark-table/update-10th/1k duration 117.60 (±0.00 ms) 114.30 (±0.00 ms) -3.3ms (2.8%) 👌
tablecmp-append-1k metric base(ae82aa7) target(7576413) trend
benchmark-table-component/append/1k duration 1048.40 (±0.00 ms) 1026.40 (±0.00 ms) -22.0ms (2.1%) 👌
tablecmp-clear-1k metric base(ae82aa7) target(7576413) trend
benchmark-table-component/clear/1k duration 172.90 (±0.00 ms) 223.70 (±0.00 ms) +50.8ms (29.4%) 👌
tablecmp-create-10k metric base(ae82aa7) target(7576413) trend
benchmark-table-component/create/10k duration 10484.50 (±0.00 ms) 10603.60 (±0.00 ms) +119.1ms (1.1%) 👌
tablecmp-create-1k metric base(ae82aa7) target(7576413) trend
benchmark-table-component/create/1k duration 952.90 (±0.00 ms) 944.20 (±0.00 ms) -8.7ms (0.9%) 👌
tablecmp-update-10th-1k metric base(ae82aa7) target(7576413) trend
benchmark-table-component/update-10th/1k duration 87.10 (±0.00 ms) 145.00 (±0.00 ms) +57.9ms (66.5%) 👌

@salesforce-best-lwc-internal
Copy link

Benchmark results

Base commit: 2aa6b1d | Target commit: aae9989

lwc-engine-benchmark-ie11

table-append-1k metric base(2aa6b1d) target(aae9989) trend
benchmark-table/append/1k duration 796.50 (±0.00 ms) 793.80 (±0.00 ms) -2.7ms (0.3%) 👌
table-clear-1k metric base(2aa6b1d) target(aae9989) trend
benchmark-table/clear/1k duration 82.00 (±0.00 ms) 76.30 (±0.00 ms) -5.7ms (7.0%) 👌
table-create-10k metric base(2aa6b1d) target(aae9989) trend
benchmark-table/create/10k duration 7454.90 (±0.00 ms) 7395.70 (±0.00 ms) -59.2ms (0.8%) 👌
table-create-1k metric base(2aa6b1d) target(aae9989) trend
benchmark-table/create/1k duration 670.50 (±0.00 ms) 673.10 (±0.00 ms) +2.6ms (0.4%) 👌
table-update-10th-1k metric base(2aa6b1d) target(aae9989) trend
benchmark-table/update-10th/1k duration 109.10 (±0.00 ms) 112.00 (±0.00 ms) +2.9ms (2.7%) 👌
tablecmp-append-1k metric base(2aa6b1d) target(aae9989) trend
benchmark-table-component/append/1k duration 1036.10 (±0.00 ms) 1053.80 (±0.00 ms) +17.7ms (1.7%) 👌
tablecmp-clear-1k metric base(2aa6b1d) target(aae9989) trend
benchmark-table-component/clear/1k duration 174.40 (±0.00 ms) 195.80 (±0.00 ms) +21.4ms (12.3%) 👌
tablecmp-create-10k metric base(2aa6b1d) target(aae9989) trend
benchmark-table-component/create/10k duration 11640.10 (±0.00 ms) 10493.40 (±0.00 ms) -1146.7ms (9.9%) 👌
tablecmp-create-1k metric base(2aa6b1d) target(aae9989) trend
benchmark-table-component/create/1k duration 952.90 (±0.00 ms) 952.90 (±0.00 ms) 0.0ms (0.0%) 👌
tablecmp-update-10th-1k metric base(2aa6b1d) target(aae9989) trend
benchmark-table-component/update-10th/1k duration 149.10 (±0.00 ms) 99.20 (±0.00 ms) -49.9ms (33.5%) 👌

@salesforce-best-lwc-internal
Copy link

Benchmark results

Base commit: 2aa6b1d | Target commit: aae9989

lwc-engine-benchmark-ie11

table-append-1k metric base(2aa6b1d) target(aae9989) trend
benchmark-table/append/1k duration 796.50 (±0.00 ms) 831.30 (±0.00 ms) +34.8ms (4.4%) 👌
table-clear-1k metric base(2aa6b1d) target(aae9989) trend
benchmark-table/clear/1k duration 82.00 (±0.00 ms) 79.20 (±0.00 ms) -2.8ms (3.4%) 👌
table-create-10k metric base(2aa6b1d) target(aae9989) trend
benchmark-table/create/10k duration 7454.90 (±0.00 ms) 7383.10 (±0.00 ms) -71.8ms (1.0%) 👌
table-create-1k metric base(2aa6b1d) target(aae9989) trend
benchmark-table/create/1k duration 670.50 (±0.00 ms) 680.20 (±0.00 ms) +9.7ms (1.4%) 👌
table-update-10th-1k metric base(2aa6b1d) target(aae9989) trend
benchmark-table/update-10th/1k duration 109.10 (±0.00 ms) 101.70 (±0.00 ms) -7.4ms (6.8%) 👌
tablecmp-append-1k metric base(2aa6b1d) target(aae9989) trend
benchmark-table-component/append/1k duration 1036.10 (±0.00 ms) 1017.90 (±0.00 ms) -18.2ms (1.8%) 👌
tablecmp-clear-1k metric base(2aa6b1d) target(aae9989) trend
benchmark-table-component/clear/1k duration 174.40 (±0.00 ms) 191.60 (±0.00 ms) +17.2ms (9.9%) 👌
tablecmp-create-10k metric base(2aa6b1d) target(aae9989) trend
benchmark-table-component/create/10k duration 11640.10 (±0.00 ms) 10845.40 (±0.00 ms) -794.7ms (6.8%) 👌
tablecmp-create-1k metric base(2aa6b1d) target(aae9989) trend
benchmark-table-component/create/1k duration 952.90 (±0.00 ms) 937.20 (±0.00 ms) -15.7ms (1.6%) 👌
tablecmp-update-10th-1k metric base(2aa6b1d) target(aae9989) trend
benchmark-table-component/update-10th/1k duration 149.10 (±0.00 ms) 95.30 (±0.00 ms) -53.8ms (36.1%) 👌

@salesforce-best-lwc-internal
Copy link

Benchmark results

Base commit: 7a22a8b | Target commit: 8eab8c6

lwc-engine-benchmark

table-append-1k metric base(7a22a8b) target(8eab8c6) trend
benchmark-table/append/1k duration 158.35 (±7.10 ms) 154.50 (±4.70 ms) -3.9ms (2.4%) 👍
table-clear-1k metric base(7a22a8b) target(8eab8c6) trend
benchmark-table/clear/1k duration 12.65 (±0.65 ms) 12.10 (±0.70 ms) -0.5ms (4.3%) 👍
table-create-10k metric base(7a22a8b) target(8eab8c6) trend
benchmark-table/create/10k duration 881.35 (±6.75 ms) 866.30 (±5.80 ms) -15.0ms (1.7%) 👍
table-create-1k metric base(7a22a8b) target(8eab8c6) trend
benchmark-table/create/1k duration 110.05 (±2.20 ms) 107.25 (±2.30 ms) -2.8ms (2.5%) 👍
table-update-10th-1k metric base(7a22a8b) target(8eab8c6) trend
benchmark-table/update-10th/1k duration 86.65 (±2.40 ms) 96.80 (±1.70 ms) +10.1ms (11.7%) 👎
tablecmp-append-1k metric base(7a22a8b) target(8eab8c6) trend
benchmark-table-component/append/1k duration 203.85 (±7.15 ms) 205.75 (±10.15 ms) +1.9ms (0.9%) 👌
tablecmp-clear-1k metric base(7a22a8b) target(8eab8c6) trend
benchmark-table-component/clear/1k duration 20.30 (±1.45 ms) 19.20 (±1.50 ms) -1.1ms (5.4%) 👌
tablecmp-create-10k metric base(7a22a8b) target(8eab8c6) trend
benchmark-table-component/create/10k duration 1613.75 (±9.95 ms) 1662.30 (±11.85 ms) +48.6ms (3.0%) 👎
tablecmp-create-1k metric base(7a22a8b) target(8eab8c6) trend
benchmark-table-component/create/1k duration 186.65 (±4.75 ms) 188.60 (±5.45 ms) +2.0ms (1.0%) 👌
tablecmp-update-10th-1k metric base(7a22a8b) target(8eab8c6) trend
benchmark-table-component/update-10th/1k duration 82.40 (±5.00 ms) 82.90 (±6.60 ms) +0.5ms (0.6%) 👌
wc-append-1k metric base(7a22a8b) target(8eab8c6) trend
benchmark-table-wc/append/1k duration 264.65 (±18.90 ms) 277.50 (±12.35 ms) +12.9ms (4.9%) 👎
wc-clear-1k metric base(7a22a8b) target(8eab8c6) trend
benchmark-table-wc/clear/1k duration 29.50 (±2.75 ms) 28.85 (±1.70 ms) -0.6ms (2.2%) 👌
wc-create-10k metric base(7a22a8b) target(8eab8c6) trend
benchmark-table-wc/create/10k duration 2064.60 (±12.20 ms) 2074.45 (±13.50 ms) +9.8ms (0.5%) 👎
wc-create-1k metric base(7a22a8b) target(8eab8c6) trend
benchmark-table-wc/create/1k duration 222.00 (±6.00 ms) 225.95 (±4.10 ms) +3.9ms (1.8%) 👎
wc-update-10th-1k metric base(7a22a8b) target(8eab8c6) trend
benchmark-table-wc/update-10th/1k duration 85.40 (±8.00 ms) 84.00 (±5.40 ms) -1.4ms (1.6%) 👌

@apapko
Copy link
Collaborator

apapko commented Oct 9, 2018

Please ignore my accidental approval

@salesforce-best-lwc-internal
Copy link

Benchmark results

Base commit: 7a22a8b | Target commit: ec5f10a

lwc-engine-benchmark

table-append-1k metric base(7a22a8b) target(ec5f10a) trend
benchmark-table/append/1k duration 158.35 (±7.10 ms) 150.90 (±6.30 ms) -7.5ms (4.7%) 👍
table-clear-1k metric base(7a22a8b) target(ec5f10a) trend
benchmark-table/clear/1k duration 12.65 (±0.65 ms) 11.90 (±0.70 ms) -0.7ms (5.9%) 👍
table-create-10k metric base(7a22a8b) target(ec5f10a) trend
benchmark-table/create/10k duration 881.35 (±6.75 ms) 873.10 (±5.05 ms) -8.3ms (0.9%) 👍
table-create-1k metric base(7a22a8b) target(ec5f10a) trend
benchmark-table/create/1k duration 110.05 (±2.20 ms) 109.05 (±2.75 ms) -1.0ms (0.9%) 👌
table-update-10th-1k metric base(7a22a8b) target(ec5f10a) trend
benchmark-table/update-10th/1k duration 86.65 (±2.40 ms) 85.05 (±2.95 ms) -1.6ms (1.8%) 👍
tablecmp-append-1k metric base(7a22a8b) target(ec5f10a) trend
benchmark-table-component/append/1k duration 203.85 (±7.15 ms) 203.60 (±8.50 ms) -0.3ms (0.1%) 👌
tablecmp-clear-1k metric base(7a22a8b) target(ec5f10a) trend
benchmark-table-component/clear/1k duration 20.30 (±1.45 ms) 19.05 (±1.75 ms) -1.3ms (6.2%) 👍
tablecmp-create-10k metric base(7a22a8b) target(ec5f10a) trend
benchmark-table-component/create/10k duration 1613.75 (±9.95 ms) 1671.25 (±10.65 ms) +57.5ms (3.6%) 👎
tablecmp-create-1k metric base(7a22a8b) target(ec5f10a) trend
benchmark-table-component/create/1k duration 186.65 (±4.75 ms) 189.10 (±5.45 ms) +2.4ms (1.3%) 👌
tablecmp-update-10th-1k metric base(7a22a8b) target(ec5f10a) trend
benchmark-table-component/update-10th/1k duration 82.40 (±5.00 ms) 81.65 (±6.75 ms) -0.8ms (0.9%) 👌
wc-append-1k metric base(7a22a8b) target(ec5f10a) trend
benchmark-table-wc/append/1k duration 264.65 (±18.90 ms) 279.70 (±10.45 ms) +15.1ms (5.7%) 👎
wc-clear-1k metric base(7a22a8b) target(ec5f10a) trend
benchmark-table-wc/clear/1k duration 29.50 (±2.75 ms) 29.80 (±2.40 ms) +0.3ms (1.0%) 👌
wc-create-10k metric base(7a22a8b) target(ec5f10a) trend
benchmark-table-wc/create/10k duration 2064.60 (±12.20 ms) 2082.75 (±10.00 ms) +18.1ms (0.9%) 👎
wc-create-1k metric base(7a22a8b) target(ec5f10a) trend
benchmark-table-wc/create/1k duration 222.00 (±6.00 ms) 228.70 (±4.90 ms) +6.7ms (3.0%) 👎
wc-update-10th-1k metric base(7a22a8b) target(ec5f10a) trend
benchmark-table-wc/update-10th/1k duration 85.40 (±8.00 ms) 82.85 (±5.75 ms) -2.6ms (3.0%) 👍

@pmdartus
Copy link
Member

pmdartus commented Oct 9, 2018

Regression with style tag injection looks fine. @caridy, @diervo can you do another pass just to make sure we are not missing anything?

@pmdartus pmdartus requested a review from diervo October 9, 2018 21:30
@caridy
Copy link
Contributor Author

caridy commented Oct 9, 2018

@pmdartus this is considering that we will always insert that style tag as the first argument? even when empty? is @diervo ok with that? last time we spoke about this he convinced me that in fallback we should not do it, considering that we are banning firstChild and childNodes all together.

@pmdartus
Copy link
Member

pmdartus commented Oct 9, 2018

I ok with both approaches.

@caridy
Copy link
Contributor Author

caridy commented Oct 10, 2018

@diervo, can you comment here?


// Inserting a placeholder for <style> to guarantee that native and synthetic shadow markup
// are identical.
styleElement = getCachedStyleElement(process.env.NODE_ENV !== 'production' ? `/* synthetic style for component ${shadowSelector} */` : '');
Copy link
Member

Choose a reason for hiding this comment

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

Let's remove this for now.

@@ -133,6 +113,10 @@ export function evaluateTemplate(vm: VM, html: Template): Array<VNode|null> {
}
const vnodes = html.call(undefined, api, component, cmpSlots, context.tplCache);

const { styleVNode } = context;
// inserting the style tag at the top always
ArrayUnshift.call(vnodes, isUndefined(styleVNode) ? null : styleVNode);
Copy link
Member

Choose a reason for hiding this comment

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

Add a surrounding branch to not do the unshift if the styleVNode is undefined.

caridy and others added 3 commits October 10, 2018 14:40
fix(engine): integration test

feat(compiler): inline styles to support native shadow (#691)

Add compiler changes required for the shadow DOM injection of the stylesheet.
The CSS transformer now attach to the template an object with 3 properties:
* `hostAttribute` - the attribute to apply to the host element
* `shadowAttribute` - the attribute to apply to the shadow elements
* `factory` - a function accepting a `hostSelector` and a `shadowSelector` to apply to the styles.

Note the difference in naming, `hostAttribute` is the attribute name, while the factory excepts a selector `[attr]`. This changes is necessary to be able to generate at runtime both native and synthetic shadow compatible stylesheets.

Changes:
* Make changes to the CSS transform, it nows accepts 2 parameters a `hostSelector` and a `shadowSelector`.
* Update the compiler produce the new `Stylesheet` format for runtime consumption
* Update references to `styleToken` in the engine code to `styleAttribute` to better match the actual purpose

* [ ] Yes
* [X] No - as long as nobody is invoking the CSS transform manually since it's signature changed

fix: removed file missed during squash
@salesforce-best-lwc-internal
Copy link

Benchmark results

Base commit: f9ffc5c | Target commit: fe59813

lwc-engine-benchmark

table-append-1k metric base(f9ffc5c) target(fe59813) trend
benchmark-table/append/1k duration 152.15 (±5.55 ms) 153.45 (±6.10 ms) +1.3ms (0.9%) 👌
table-clear-1k metric base(f9ffc5c) target(fe59813) trend
benchmark-table/clear/1k duration 12.05 (±0.55 ms) 11.85 (±0.75 ms) -0.2ms (1.7%) 👌
table-create-10k metric base(f9ffc5c) target(fe59813) trend
benchmark-table/create/10k duration 870.20 (±6.30 ms) 870.40 (±6.30 ms) +0.2ms (0.0%) 👌
table-create-1k metric base(f9ffc5c) target(fe59813) trend
benchmark-table/create/1k duration 107.00 (±2.15 ms) 107.35 (±1.60 ms) +0.3ms (0.3%) 👌
table-update-10th-1k metric base(f9ffc5c) target(fe59813) trend
benchmark-table/update-10th/1k duration 83.80 (±2.35 ms) 95.40 (±2.35 ms) +11.6ms (13.8%) 👎
tablecmp-append-1k metric base(f9ffc5c) target(fe59813) trend
benchmark-table-component/append/1k duration 206.85 (±9.75 ms) 201.05 (±9.35 ms) -5.8ms (2.8%) 👌
tablecmp-clear-1k metric base(f9ffc5c) target(fe59813) trend
benchmark-table-component/clear/1k duration 19.40 (±2.20 ms) 19.70 (±1.65 ms) +0.3ms (1.5%) 👌
tablecmp-create-10k metric base(f9ffc5c) target(fe59813) trend
benchmark-table-component/create/10k duration 1576.55 (±10.70 ms) 1602.75 (±13.40 ms) +26.2ms (1.7%) 👎
tablecmp-create-1k metric base(f9ffc5c) target(fe59813) trend
benchmark-table-component/create/1k duration 179.25 (±6.35 ms) 180.80 (±5.45 ms) +1.6ms (0.9%) 👌
tablecmp-update-10th-1k metric base(f9ffc5c) target(fe59813) trend
benchmark-table-component/update-10th/1k duration 77.80 (±3.80 ms) 82.65 (±5.35 ms) +4.8ms (6.2%) 👎
wc-append-1k metric base(f9ffc5c) target(fe59813) trend
benchmark-table-wc/append/1k duration 268.60 (±12.20 ms) 274.70 (±8.05 ms) +6.1ms (2.3%) 👎
wc-clear-1k metric base(f9ffc5c) target(fe59813) trend
benchmark-table-wc/clear/1k duration 27.25 (±2.25 ms) 27.50 (±2.30 ms) +0.3ms (0.9%) 👌
wc-create-10k metric base(f9ffc5c) target(fe59813) trend
benchmark-table-wc/create/10k duration 2049.60 (±13.65 ms) 2023.30 (±11.75 ms) -26.3ms (1.3%) 👍
wc-create-1k metric base(f9ffc5c) target(fe59813) trend
benchmark-table-wc/create/1k duration 219.00 (±3.60 ms) 218.95 (±6.75 ms) -0.1ms (0.0%) 👌
wc-update-10th-1k metric base(f9ffc5c) target(fe59813) trend
benchmark-table-wc/update-10th/1k duration 80.85 (±5.90 ms) 82.85 (±5.60 ms) +2.0ms (2.5%) 👌

@salesforce-best-lwc-internal
Copy link

Benchmark results

Base commit: f9ffc5c | Target commit: 3eda965

lwc-engine-benchmark

table-append-1k metric base(f9ffc5c) target(3eda965) trend
benchmark-table/append/1k duration 152.20 (±5.65 ms) 151.90 (±5.90 ms) -0.3ms (0.2%) 👌
table-clear-1k metric base(f9ffc5c) target(3eda965) trend
benchmark-table/clear/1k duration 11.85 (±0.95 ms) 11.80 (±0.90 ms) -0.1ms (0.4%) 👌
table-create-10k metric base(f9ffc5c) target(3eda965) trend
benchmark-table/create/10k duration 877.20 (±6.05 ms) 896.25 (±9.65 ms) +19.0ms (2.2%) 👎
table-create-1k metric base(f9ffc5c) target(3eda965) trend
benchmark-table/create/1k duration 108.15 (±1.90 ms) 109.45 (±2.95 ms) +1.3ms (1.2%) 👌
table-update-10th-1k metric base(f9ffc5c) target(3eda965) trend
benchmark-table/update-10th/1k duration 84.65 (±1.85 ms) 89.25 (±6.55 ms) +4.6ms (5.4%) 👎
tablecmp-append-1k metric base(f9ffc5c) target(3eda965) trend
benchmark-table-component/append/1k duration 213.40 (±13.75 ms) 198.75 (±6.65 ms) -14.7ms (6.9%) 👍
tablecmp-clear-1k metric base(f9ffc5c) target(3eda965) trend
benchmark-table-component/clear/1k duration 19.20 (±1.35 ms) 18.95 (±1.50 ms) -0.3ms (1.3%) 👌
tablecmp-create-10k metric base(f9ffc5c) target(3eda965) trend
benchmark-table-component/create/10k duration 1575.25 (±9.05 ms) 1630.40 (±9.20 ms) +55.2ms (3.5%) 👎
tablecmp-create-1k metric base(f9ffc5c) target(3eda965) trend
benchmark-table-component/create/1k duration 180.25 (±5.40 ms) 182.45 (±5.35 ms) +2.2ms (1.2%) 👌
tablecmp-update-10th-1k metric base(f9ffc5c) target(3eda965) trend
benchmark-table-component/update-10th/1k duration 82.25 (±4.70 ms) 81.05 (±5.65 ms) -1.2ms (1.5%) 👌
wc-append-1k metric base(f9ffc5c) target(3eda965) trend
benchmark-table-wc/append/1k duration 274.25 (±9.15 ms) 268.90 (±16.05 ms) -5.4ms (2.0%) 👌
wc-clear-1k metric base(f9ffc5c) target(3eda965) trend
benchmark-table-wc/clear/1k duration 28.60 (±2.90 ms) 28.95 (±2.35 ms) +0.4ms (1.2%) 👌
wc-create-10k metric base(f9ffc5c) target(3eda965) trend
benchmark-table-wc/create/10k duration 2049.50 (±15.20 ms) 2045.25 (±10.50 ms) -4.3ms (0.2%) 👌
wc-create-1k metric base(f9ffc5c) target(3eda965) trend
benchmark-table-wc/create/1k duration 218.90 (±4.15 ms) 219.75 (±7.20 ms) +0.8ms (0.4%) 👌
wc-update-10th-1k metric base(f9ffc5c) target(3eda965) trend
benchmark-table-wc/update-10th/1k duration 82.60 (±5.00 ms) 81.55 (±5.95 ms) -1.0ms (1.3%) 👌

@diervo diervo merged commit cecd751 into master Oct 11, 2018
@diervo diervo deleted the caridy/style-refactor branch October 11, 2018 18:23
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.

None yet

4 participants