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): [218] implementation for clone node #864

Merged
merged 8 commits into from Nov 29, 2018

Conversation

davidturissini
Copy link
Contributor

Details

Clone node implementation for custom elements

Does this PR introduce a breaking change?

  • Yes
  • No

@pmdartus
Copy link
Member

As discussed with @davidturissini we need to also patch all the created elements internal to support the case where we invoke clone on an element that is not a custom element.

<template>
  <div> <-- node.clone(true)
    <x-foo>
      <p>

@salesforce-best-lwc-internal
Copy link

Benchmark results

Base commit: b4fad21 | Target commit: 32fb8a4

lwc-engine-benchmark

table-append-1k metric base(b4fad21) target(32fb8a4) trend
benchmark-table/append/1k duration 154.45 (±5.10 ms) 154.20 (±4.45 ms) -0.3ms (0.2%) 👌
table-clear-1k metric base(b4fad21) target(32fb8a4) trend
benchmark-table/clear/1k duration 6.40 (±0.60 ms) 6.80 (±0.55 ms) +0.4ms (6.2%) 👎
table-create-10k metric base(b4fad21) target(32fb8a4) trend
benchmark-table/create/10k duration 893.95 (±8.10 ms) 900.05 (±6.05 ms) +6.1ms (0.7%) 👎
table-create-1k metric base(b4fad21) target(32fb8a4) trend
benchmark-table/create/1k duration 120.95 (±3.85 ms) 120.70 (±3.60 ms) -0.2ms (0.2%) 👌
table-update-10th-1k metric base(b4fad21) target(32fb8a4) trend
benchmark-table/update-10th/1k duration 78.10 (±2.40 ms) 80.80 (±2.90 ms) +2.7ms (3.5%) 👎
tablecmp-append-1k metric base(b4fad21) target(32fb8a4) trend
benchmark-table-component/append/1k duration 252.75 (±7.50 ms) 255.25 (±7.05 ms) +2.5ms (1.0%) 👌
tablecmp-clear-1k metric base(b4fad21) target(32fb8a4) trend
benchmark-table-component/clear/1k duration 12.10 (±1.65 ms) 12.70 (±1.55 ms) +0.6ms (5.0%) 👌
tablecmp-create-10k metric base(b4fad21) target(32fb8a4) trend
benchmark-table-component/create/10k duration 1715.70 (±10.95 ms) 1743.75 (±11.60 ms) +28.0ms (1.6%) 👎
tablecmp-create-1k metric base(b4fad21) target(32fb8a4) trend
benchmark-table-component/create/1k duration 210.80 (±6.10 ms) 212.25 (±6.00 ms) +1.4ms (0.7%) 👌
tablecmp-update-10th-1k metric base(b4fad21) target(32fb8a4) trend
benchmark-table-component/update-10th/1k duration 73.20 (±5.55 ms) 71.75 (±4.90 ms) -1.5ms (2.0%) 👌
wc-append-1k metric base(b4fad21) target(32fb8a4) trend
benchmark-table-wc/append/1k duration 252.60 (±10.35 ms) 256.75 (±10.75 ms) +4.1ms (1.6%) 👌
wc-clear-1k metric base(b4fad21) target(32fb8a4) trend
benchmark-table-wc/clear/1k duration 22.95 (±2.30 ms) 23.20 (±2.30 ms) +0.3ms (1.1%) 👌
wc-create-10k metric base(b4fad21) target(32fb8a4) trend
benchmark-table-wc/create/10k duration 1797.00 (±35.70 ms) 1809.45 (±45.40 ms) +12.5ms (0.7%) 👌
wc-create-1k metric base(b4fad21) target(32fb8a4) trend
benchmark-table-wc/create/1k duration 225.90 (±6.40 ms) 229.15 (±6.20 ms) +3.2ms (1.4%) 👌
wc-update-10th-1k metric base(b4fad21) target(32fb8a4) trend
benchmark-table-wc/update-10th/1k duration 73.35 (±6.00 ms) 74.90 (±5.40 ms) +1.6ms (2.1%) 👌

@salesforce-best-lwc-internal
Copy link

Benchmark results

Base commit: b4fad21 | Target commit: f9b8391

lwc-engine-benchmark

table-append-1k metric base(b4fad21) target(f9b8391) trend
benchmark-table/append/1k duration 154.45 (±5.10 ms) 155.20 (±5.20 ms) +0.8ms (0.5%) 👌
table-clear-1k metric base(b4fad21) target(f9b8391) trend
benchmark-table/clear/1k duration 6.40 (±0.60 ms) 6.80 (±0.45 ms) +0.4ms (6.2%) 👌
table-create-10k metric base(b4fad21) target(f9b8391) trend
benchmark-table/create/10k duration 893.95 (±8.10 ms) 889.05 (±7.30 ms) -4.9ms (0.5%) 👍
table-create-1k metric base(b4fad21) target(f9b8391) trend
benchmark-table/create/1k duration 120.95 (±3.85 ms) 121.20 (±3.20 ms) +0.3ms (0.2%) 👌
table-update-10th-1k metric base(b4fad21) target(f9b8391) trend
benchmark-table/update-10th/1k duration 78.10 (±2.40 ms) 79.85 (±4.20 ms) +1.8ms (2.2%) 👎
tablecmp-append-1k metric base(b4fad21) target(f9b8391) trend
benchmark-table-component/append/1k duration 252.75 (±7.50 ms) 257.65 (±6.40 ms) +4.9ms (1.9%) 👎
tablecmp-clear-1k metric base(b4fad21) target(f9b8391) trend
benchmark-table-component/clear/1k duration 12.10 (±1.65 ms) 13.05 (±1.45 ms) +1.0ms (7.9%) 👌
tablecmp-create-10k metric base(b4fad21) target(f9b8391) trend
benchmark-table-component/create/10k duration 1715.70 (±10.95 ms) 1743.90 (±12.80 ms) +28.2ms (1.6%) 👎
tablecmp-create-1k metric base(b4fad21) target(f9b8391) trend
benchmark-table-component/create/1k duration 210.80 (±6.10 ms) 213.55 (±4.50 ms) +2.8ms (1.3%) 👌
tablecmp-update-10th-1k metric base(b4fad21) target(f9b8391) trend
benchmark-table-component/update-10th/1k duration 73.20 (±5.55 ms) 71.05 (±5.25 ms) -2.2ms (2.9%) 👌
wc-append-1k metric base(b4fad21) target(f9b8391) trend
benchmark-table-wc/append/1k duration 252.60 (±10.35 ms) 260.10 (±12.80 ms) +7.5ms (3.0%) 👎
wc-clear-1k metric base(b4fad21) target(f9b8391) trend
benchmark-table-wc/clear/1k duration 22.95 (±2.30 ms) 25.20 (±3.20 ms) +2.2ms (9.8%) 👎
wc-create-10k metric base(b4fad21) target(f9b8391) trend
benchmark-table-wc/create/10k duration 1797.00 (±35.70 ms) 1862.55 (±32.65 ms) +65.5ms (3.6%) 👎
wc-create-1k metric base(b4fad21) target(f9b8391) trend
benchmark-table-wc/create/1k duration 225.90 (±6.40 ms) 228.00 (±4.65 ms) +2.1ms (0.9%) 👌
wc-update-10th-1k metric base(b4fad21) target(f9b8391) trend
benchmark-table-wc/update-10th/1k duration 73.35 (±6.00 ms) 73.00 (±5.15 ms) -0.3ms (0.5%) 👌

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.

LGTM!

@salesforce-best-lwc-internal
Copy link

Benchmark results

Base commit: b4fad21 | Target commit: 8164c52

lwc-engine-benchmark

table-append-1k metric base(b4fad21) target(8164c52) trend
benchmark-table/append/1k duration 154.45 (±5.10 ms) 154.45 (±5.65 ms) 0.0ms (0.0%) 👌
table-clear-1k metric base(b4fad21) target(8164c52) trend
benchmark-table/clear/1k duration 6.40 (±0.60 ms) 6.75 (±0.45 ms) +0.3ms (5.5%) 👌
table-create-10k metric base(b4fad21) target(8164c52) trend
benchmark-table/create/10k duration 893.95 (±8.10 ms) 890.80 (±7.40 ms) -3.2ms (0.4%) 👌
table-create-1k metric base(b4fad21) target(8164c52) trend
benchmark-table/create/1k duration 120.95 (±3.85 ms) 119.30 (±2.95 ms) -1.6ms (1.4%) 👌
table-update-10th-1k metric base(b4fad21) target(8164c52) trend
benchmark-table/update-10th/1k duration 78.10 (±2.40 ms) 78.80 (±3.85 ms) +0.7ms (0.9%) 👌
tablecmp-append-1k metric base(b4fad21) target(8164c52) trend
benchmark-table-component/append/1k duration 252.75 (±7.50 ms) 262.05 (±5.50 ms) +9.3ms (3.7%) 👎
tablecmp-clear-1k metric base(b4fad21) target(8164c52) trend
benchmark-table-component/clear/1k duration 12.10 (±1.65 ms) 13.55 (±1.95 ms) +1.5ms (12.0%) 👎
tablecmp-create-10k metric base(b4fad21) target(8164c52) trend
benchmark-table-component/create/10k duration 1715.70 (±10.95 ms) 1736.45 (±10.80 ms) +20.8ms (1.2%) 👎
tablecmp-create-1k metric base(b4fad21) target(8164c52) trend
benchmark-table-component/create/1k duration 210.80 (±6.10 ms) 214.45 (±5.45 ms) +3.6ms (1.7%) 👎
tablecmp-update-10th-1k metric base(b4fad21) target(8164c52) trend
benchmark-table-component/update-10th/1k duration 73.20 (±5.55 ms) 73.90 (±5.15 ms) +0.7ms (1.0%) 👌
wc-append-1k metric base(b4fad21) target(8164c52) trend
benchmark-table-wc/append/1k duration 252.60 (±10.35 ms) 262.60 (±9.55 ms) +10.0ms (4.0%) 👎
wc-clear-1k metric base(b4fad21) target(8164c52) trend
benchmark-table-wc/clear/1k duration 22.95 (±2.30 ms) 22.75 (±2.70 ms) -0.2ms (0.9%) 👌
wc-create-10k metric base(b4fad21) target(8164c52) trend
benchmark-table-wc/create/10k duration 1797.00 (±35.70 ms) 1822.25 (±32.05 ms) +25.3ms (1.4%) 👌
wc-create-1k metric base(b4fad21) target(8164c52) trend
benchmark-table-wc/create/1k duration 225.90 (±6.40 ms) 227.00 (±3.65 ms) +1.1ms (0.5%) 👌
wc-update-10th-1k metric base(b4fad21) target(8164c52) trend
benchmark-table-wc/update-10th/1k duration 73.35 (±6.00 ms) 75.55 (±5.50 ms) +2.2ms (3.0%) 👌

@salesforce-best-lwc-internal
Copy link

Benchmark results

Base commit: b4fad21 | Target commit: 256bc6b

lwc-engine-benchmark

table-append-1k metric base(b4fad21) target(256bc6b) trend
benchmark-table/append/1k duration 154.45 (±5.10 ms) 156.75 (±6.30 ms) +2.3ms (1.5%) 👌
table-clear-1k metric base(b4fad21) target(256bc6b) trend
benchmark-table/clear/1k duration 6.40 (±0.60 ms) 6.60 (±0.50 ms) +0.2ms (3.1%) 👌
table-create-10k metric base(b4fad21) target(256bc6b) trend
benchmark-table/create/10k duration 893.95 (±8.10 ms) 888.05 (±7.15 ms) -5.9ms (0.7%) 👍
table-create-1k metric base(b4fad21) target(256bc6b) trend
benchmark-table/create/1k duration 120.95 (±3.85 ms) 120.90 (±3.10 ms) -0.0ms (0.0%) 👌
table-update-10th-1k metric base(b4fad21) target(256bc6b) trend
benchmark-table/update-10th/1k duration 78.10 (±2.40 ms) 79.00 (±3.90 ms) +0.9ms (1.2%) 👌
tablecmp-append-1k metric base(b4fad21) target(256bc6b) trend
benchmark-table-component/append/1k duration 252.75 (±7.50 ms) 257.55 (±5.70 ms) +4.8ms (1.9%) 👎
tablecmp-clear-1k metric base(b4fad21) target(256bc6b) trend
benchmark-table-component/clear/1k duration 12.10 (±1.65 ms) 12.60 (±1.55 ms) +0.5ms (4.1%) 👌
tablecmp-create-10k metric base(b4fad21) target(256bc6b) trend
benchmark-table-component/create/10k duration 1715.70 (±10.95 ms) 1776.25 (±12.20 ms) +60.5ms (3.5%) 👎
tablecmp-create-1k metric base(b4fad21) target(256bc6b) trend
benchmark-table-component/create/1k duration 210.80 (±6.10 ms) 210.80 (±5.60 ms) 0.0ms (0.0%) 👌
tablecmp-update-10th-1k metric base(b4fad21) target(256bc6b) trend
benchmark-table-component/update-10th/1k duration 73.20 (±5.55 ms) 73.55 (±5.10 ms) +0.3ms (0.5%) 👌
wc-append-1k metric base(b4fad21) target(256bc6b) trend
benchmark-table-wc/append/1k duration 252.60 (±10.35 ms) 262.65 (±10.30 ms) +10.0ms (4.0%) 👎
wc-clear-1k metric base(b4fad21) target(256bc6b) trend
benchmark-table-wc/clear/1k duration 22.95 (±2.30 ms) 24.15 (±2.30 ms) +1.2ms (5.2%) 👎
wc-create-10k metric base(b4fad21) target(256bc6b) trend
benchmark-table-wc/create/10k duration 1797.00 (±35.70 ms) 1813.35 (±39.30 ms) +16.3ms (0.9%) 👌
wc-create-1k metric base(b4fad21) target(256bc6b) trend
benchmark-table-wc/create/1k duration 225.90 (±6.40 ms) 225.10 (±4.55 ms) -0.8ms (0.4%) 👌
wc-update-10th-1k metric base(b4fad21) target(256bc6b) trend
benchmark-table-wc/update-10th/1k duration 73.35 (±6.00 ms) 72.40 (±5.50 ms) -0.9ms (1.3%) 👌

Copy link
Member

@ekashida ekashida left a comment

Choose a reason for hiding this comment

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

Also, should we add a test dealing with slotted slots?

cloneNode(deep: boolean): Node {
const clone = nativeCloneNode.call(this, false);

if (isFalse(deep)) {
Copy link
Member

Choose a reason for hiding this comment

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

Seems like all the browsers don't care about strict boolean equality.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure what this means @ekashida

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I understand. Browsers really only care about truthy, not strict true or false. I'll update this

@davidturissini
Copy link
Contributor Author

@salesforce-best-lwc-internal
Copy link

Benchmark results

Base commit: f439c16 | Target commit: 9945527

lwc-engine-benchmark

table-append-1k metric base(f439c16) target(9945527) trend
benchmark-table/append/1k duration 155.75 (±3.30 ms) 154.70 (±4.60 ms) -1.1ms (0.7%) 👌
table-clear-1k metric base(f439c16) target(9945527) trend
benchmark-table/clear/1k duration 6.75 (±0.30 ms) 6.75 (±0.35 ms) 0.0ms (0.0%) 👌
table-create-10k metric base(f439c16) target(9945527) trend
benchmark-table/create/10k duration 902.35 (±7.55 ms) 889.90 (±6.55 ms) -12.4ms (1.4%) 👍
table-create-1k metric base(f439c16) target(9945527) trend
benchmark-table/create/1k duration 120.50 (±1.70 ms) 119.55 (±2.55 ms) -1.0ms (0.8%) 👌
table-update-10th-1k metric base(f439c16) target(9945527) trend
benchmark-table/update-10th/1k duration 79.40 (±2.75 ms) 78.55 (±1.90 ms) -0.9ms (1.1%) 👌
tablecmp-append-1k metric base(f439c16) target(9945527) trend
benchmark-table-component/append/1k duration 260.20 (±6.50 ms) 258.30 (±4.80 ms) -1.9ms (0.7%) 👌
tablecmp-clear-1k metric base(f439c16) target(9945527) trend
benchmark-table-component/clear/1k duration 12.80 (±1.70 ms) 13.65 (±1.70 ms) +0.8ms (6.6%) 👌
tablecmp-create-10k metric base(f439c16) target(9945527) trend
benchmark-table-component/create/10k duration 1756.60 (±16.90 ms) 1737.65 (±13.00 ms) -18.9ms (1.1%) 👍
tablecmp-create-1k metric base(f439c16) target(9945527) trend
benchmark-table-component/create/1k duration 213.60 (±5.45 ms) 212.15 (±6.20 ms) -1.5ms (0.7%) 👌
tablecmp-update-10th-1k metric base(f439c16) target(9945527) trend
benchmark-table-component/update-10th/1k duration 71.60 (±5.00 ms) 73.80 (±5.35 ms) +2.2ms (3.1%) 👌
wc-append-1k metric base(f439c16) target(9945527) trend
benchmark-table-wc/append/1k duration 267.95 (±8.05 ms) 257.90 (±10.20 ms) -10.1ms (3.8%) 👍
wc-clear-1k metric base(f439c16) target(9945527) trend
benchmark-table-wc/clear/1k duration 22.70 (±2.45 ms) 22.60 (±2.30 ms) -0.1ms (0.4%) 👌
wc-create-10k metric base(f439c16) target(9945527) trend
benchmark-table-wc/create/10k duration 1874.90 (±56.75 ms) 1828.55 (±48.60 ms) -46.4ms (2.5%) 👍
wc-create-1k metric base(f439c16) target(9945527) trend
benchmark-table-wc/create/1k duration 224.15 (±6.15 ms) 228.60 (±8.60 ms) +4.5ms (2.0%) 👎
wc-update-10th-1k metric base(f439c16) target(9945527) trend
benchmark-table-wc/update-10th/1k duration 74.85 (±5.50 ms) 75.65 (±5.35 ms) +0.8ms (1.1%) 👌

</x-grand>
<div></div>
</x-child>
</template>
Copy link
Member

@ekashida ekashida Nov 29, 2018

Choose a reason for hiding this comment

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

I was thinking more like

<template>
    <x-child>
        <x-grand>
            <slot>
                <div>No clone</div>
            </slot>
        </x-grand>
    </x-child>
</template>

but it almost feels like it would be testing something else at that point.

@davidturissini davidturissini merged commit 0f41231 into master Nov 29, 2018
@davidturissini davidturissini deleted the dturissini/clone-node branch November 29, 2018 19:12
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