<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>73737</bug_id>
          
          <creation_ts>2011-12-02 23:32:11 -0800</creation_ts>
          <short_desc>HIERARCHY_REQUEST_ERR check in checkAcceptChild should be optimized for newChild without children</short_desc>
          <delta_ts>2011-12-16 23:50:25 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>DOM</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>73802</dependson>
          <blocked>73853</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Ryosuke Niwa">rniwa</reporter>
          <assigned_to name="Ryosuke Niwa">rniwa</assigned_to>
          <cc>arv</cc>
    
    <cc>darin</cc>
    
    <cc>eae</cc>
    
    <cc>ggaren</cc>
    
    <cc>mjs</cc>
    
    <cc>ojan</cc>
    
    <cc>sam</cc>
    
    <cc>webkit.review.bot</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>514445</commentid>
    <comment_count>0</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2011-12-02 23:32:11 -0800</bug_when>
    <thetext>Per statistics posted in http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2011-December/034038.html,
it&apos;s pretty clear that the check for HIERARCHY_REQUEST_ERR in checkAcceptChild should be optimized for the case
where newChild doesn&apos;t have any children or less than 10 children.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>514447</commentid>
    <comment_count>1</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2011-12-02 23:32:37 -0800</bug_when>
    <thetext>Diff I used to collect statistics for completeness:

Index: Source/WebCore/dom/Node.cpp
===================================================================
--- Source/WebCore/dom/Node.cpp	(revision 101848)
+++ Source/WebCore/dom/Node.cpp	(working copy)
@@ -1309,6 +1309,15 @@
 
     // HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of the
     // newChild node, or if the node to append is one of this node&apos;s ancestors.
+    {
+        unsigned i = 0;
+        for (Node* node = newChild; node &amp;&amp; i &lt; 100; node = node-&gt;traverseNextNode(newChild))
+            i++;
+        if (i &lt; 100)
+            fprintf(stderr, &quot;inserting child with %d nodes\n&quot;, i);
+        else
+            fprintf(stderr, &quot;inserting child with 100+ nodes\n&quot;);
+    }
 
     if (newChild == newParent || newParent-&gt;isDescendantOf(newChild)) {
         ec = HIERARCHY_REQUEST_ERR;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>514460</commentid>
    <comment_count>2</comment_count>
      <attachid>117749</attachid>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2011-12-03 01:15:27 -0800</bug_when>
    <thetext>Created attachment 117749
perf test</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>514467</commentid>
    <comment_count>3</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2011-12-03 01:28:59 -0800</bug_when>
    <thetext>I took 11 samples on Apple&apos;s mac port applied on r101862.

Without patch:
shallow tree: 2ms
deep tree: 4.09ms (std:0.3)
deeper tree: 11.45ms (std:0.5)

With patch:
shallow tree: 2ms
deep tree: 3ms
deeper tree: 6.91ms (std 0.3)

40% improvement! The number, however, indicates that we have at least one more linear algorithm hidden somewhere.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>514468</commentid>
    <comment_count>4</comment_count>
      <attachid>117751</attachid>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2011-12-03 01:35:21 -0800</bug_when>
    <thetext>Created attachment 117751
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>514565</commentid>
    <comment_count>5</comment_count>
    <who name="Erik Arvidsson">arv</who>
    <bug_when>2011-12-03 12:28:41 -0800</bug_when>
    <thetext>Thanks for bringing this up. I forgot we talked about this a while ago.

I thought of another simple optimization we could do here. If we are comparing two trees that have different inDocument state, then we know that one cannot be a descendant of the other:

if (inDocument() != other-&gt;inDocument())
    return false;

I&apos;m curious how many of the cases you saw where a node is appended that has no children falls into the above category? My gut feeling is that the building of the disconnected tree falls into the no child case and that the attachment to the document would fall into the above case.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>514584</commentid>
    <comment_count>6</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2011-12-03 15:09:59 -0800</bug_when>
    <thetext>(In reply to comment #5)
&gt; Thanks for bringing this up. I forgot we talked about this a while ago.
&gt; 
&gt; I thought of another simple optimization we could do here. If we are comparing two trees that have different inDocument state, then we know that one cannot be a descendant of the other:
&gt; 
&gt; if (inDocument() != other-&gt;inDocument())
&gt;     return false;
&gt; 
&gt; I&apos;m curious how many of the cases you saw where a node is appended that has no children falls into the above category? My gut feeling is that the building of the disconnected tree falls into the no child case and that the attachment to the document would fall into the above case.

That&apos;s an excellent obervation obervstion. I&apos;m going to collect a stat on this as well as the number of ancesors newParent has.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>514605</commentid>
    <comment_count>7</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2011-12-03 19:27:18 -0800</bug_when>
    <thetext>That code counts the total number of descendants, not the number of children.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>514625</commentid>
    <comment_count>8</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2011-12-03 21:00:34 -0800</bug_when>
    <thetext>(In reply to comment #7)
&gt; That code counts the total number of descendants, not the number of children.

Oh, right. That&apos;s what I meant. New stat coming per Erik&apos;s comment. Will wait landing this patch until that.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>514645</commentid>
    <comment_count>9</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2011-12-03 23:19:09 -0800</bug_when>
    <thetext>(In reply to comment #5)
&gt; I&apos;m curious how many of the cases you saw where a node is appended that has no children falls into the above category? My gut feeling is that the building of the disconnected tree falls into the no child case and that the attachment to the document would fall into the above case.

59%.

Sample size: 42,000 - 1

n = Number of inserted nodes
    1     2     7     6  100+     3   10+     5     4   20+
0.679 0.089 0.038 0.029 0.028 0.024 0.021 0.018 0.013 0.011

d = Number of ancestors of new parent
    1   20+   10+     3     2     4     5     9     8     6
0.544 0.160 0.114 0.077 0.061 0.011 0.010 0.008 0.006 0.006

P(either but not both in document) = 0.625610133575

P(d=1 | n=1) ≈ 0.50007
P(parent not in document | n=1) ≈ 0.585
P(child not in document | n=1) ≈ 0.00681
P(either but not both in document | n=1) ≈ 0.589
P(either but not both in document) ≈ 0.626
P(n = 1, either but not both in document) ≈ 0.400
P(n = 1 | either but not both in document) ≈ 0.639</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>514647</commentid>
    <comment_count>10</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2011-12-03 23:55:21 -0800</bug_when>
    <thetext>My data suggests that we should do both optimizations.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>514648</commentid>
    <comment_count>11</comment_count>
      <attachid>117784</attachid>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2011-12-04 00:03:54 -0800</bug_when>
    <thetext>Created attachment 117784
Also implement arv&apos;s optimization</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>514650</commentid>
    <comment_count>12</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2011-12-04 00:48:16 -0800</bug_when>
    <thetext>Resubmitting the patch for review since I&apos;ve implemented Erik&apos;s optimization as well.

Most significantly, P(n = 1 or either but not both in document) ≈ 0.904. So this patch will make 90% of cases really fast.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>514656</commentid>
    <comment_count>13</comment_count>
      <attachid>117785</attachid>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2011-12-04 01:14:12 -0800</bug_when>
    <thetext>Created attachment 117785
new perf test

Given that parent having more than 30 ancestors is very rare, I&apos;ve updated my perf test to reflect this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>514724</commentid>
    <comment_count>14</comment_count>
    <who name="Erik Arvidsson">arv</who>
    <bug_when>2011-12-04 11:12:03 -0800</bug_when>
    <thetext>(In reply to comment #12)
&gt; Most significantly, P(n = 1 or either but not both in document) ≈ 0.904. So this patch will make 90% of cases really fast.

90%! Wow that is huge. I expect this to have big impact on Gmail. We should ask them for numbers to see how much this brings down their latency.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>514734</commentid>
    <comment_count>15</comment_count>
      <attachid>117784</attachid>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2011-12-04 12:30:04 -0800</bug_when>
    <thetext>Comment on attachment 117784
Also implement arv&apos;s optimization

Thanks for the reviews, Darin!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>514736</commentid>
    <comment_count>16</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2011-12-04 12:32:20 -0800</bug_when>
    <thetext>(In reply to comment #14)
&gt; (In reply to comment #12)
&gt; &gt; Most significantly, P(n = 1 or either but not both in document) ≈ 0.904. So this patch will make 90% of cases really fast.
&gt; 
&gt; 90%! Wow that is huge. I expect this to have big impact on Gmail. We should ask them for numbers to see how much this brings down their latency.

Hm... we still have a linear performance, and there are so many other APIs that are much slower so I&apos;ll be surprised this had any meaningful impact on Gmail but it&apos;ll great if this patch improved their latency :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>514755</commentid>
    <comment_count>17</comment_count>
      <attachid>117784</attachid>
    <who name="WebKit Review Bot">webkit.review.bot</who>
    <bug_when>2011-12-04 13:53:13 -0800</bug_when>
    <thetext>Comment on attachment 117784
Also implement arv&apos;s optimization

Clearing flags on attachment: 117784

Committed r101967: &lt;http://trac.webkit.org/changeset/101967&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>514756</commentid>
    <comment_count>18</comment_count>
    <who name="WebKit Review Bot">webkit.review.bot</who>
    <bug_when>2011-12-04 13:53:18 -0800</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="0"
              isprivate="0"
          >
            <attachid>117749</attachid>
            <date>2011-12-03 01:15:27 -0800</date>
            <delta_ts>2011-12-04 01:14:12 -0800</delta_ts>
            <desc>perf test</desc>
            <filename>insert-node-perf.html</filename>
            <type>text/html</type>
            <size>1121</size>
            <attacher name="Ryosuke Niwa">rniwa</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIGh0bWw+CjxodG1sPgo8Ym9keT4KPHVsPgo8bGk+U2hhbGxvdyB0cmVlOiA8c3Bh
biBpZD0ic2hhbGxvdyI+PC9zcGFuPiBtczwvbGk+CjxsaT5EZWVwIHRyZWUgKDIwMCspOiA8c3Bh
biBpZD0iZGVlcCI+PC9zcGFuPiBtczwvbGk+CjxsaT5EZWVwZXIgdHJlZSAoNTAwKyk6IDxzcGFu
IGlkPSJkZWVwZXIiPjwvc3Bhbj4gbXM8L2xpPgo8L3VsPgo8ZGl2IGlkPSJjb250YWluZXIiPjwv
ZGl2Pgo8c2NyaXB0PgoKZnVuY3Rpb24gc2V0dXBEZWVwVHJlZShtYWduaXR1ZGUpCnsKICAgIHZh
ciBub2RlID0gZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoJ2NvbnRhaW5lcicpOwogICAgbm9kZS5p
bm5lckhUTUwgPSAnJzsKICAgIGZvciAodmFyIGkgPSAwOyBpIDwgbWFnbml0dWRlOyBpKyspIHsK
ICAgICAgICB2YXIgY2hpbGQgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCdkaXYnKTsKICAgICAg
ICBub2RlLmFwcGVuZENoaWxkKGNoaWxkKTsKICAgICAgICBub2RlID0gY2hpbGQ7CiAgICB9CiAg
ICByZXR1cm4gbm9kZTsKfQoKZnVuY3Rpb24gdGVzdChjb250YWluZXIpCnsKICAgIHZhciBzdGFy
dFRpbWUgPSBEYXRlLm5vdygpOwogICAgdmFyIHNwYW4gPSBudWxsOwogICAgZm9yICh2YXIgaSA9
IDA7IGkgPCAxMDAwOyBpKyspIHsKICAgICAgICBzcGFuID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVu
dCgnc3BhbicpOwogICAgICAgIGNvbnRhaW5lci5hcHBlbmRDaGlsZChzcGFuKTsKICAgIH0KICAg
IGZvciAodmFyIGkgPSAwOyBpIDwgMTAwMDsgaSsrKQogICAgICAgIGNvbnRhaW5lci5pbnNlcnRC
ZWZvcmUoZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgnc3BhbicpLCBzcGFuKTsKICAgIHJldHVybiBE
YXRlLm5vdygpIC0gc3RhcnRUaW1lOwp9Cgpkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgnc2hhbGxv
dycpLmlubmVySFRNTCA9IHRlc3Qoc2V0dXBEZWVwVHJlZSgwKSk7CmRvY3VtZW50LmdldEVsZW1l
bnRCeUlkKCdkZWVwJykuaW5uZXJIVE1MID0gdGVzdChzZXR1cERlZXBUcmVlKDIwMCkpOwpkb2N1
bWVudC5nZXRFbGVtZW50QnlJZCgnZGVlcGVyJykuaW5uZXJIVE1MID0gdGVzdChzZXR1cERlZXBU
cmVlKDUwMCkpOwoKPC9zY3JpcHQ+CjwvYm9keT4KPC9odG1sPgo=
</data>

          </attachment>
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>117751</attachid>
            <date>2011-12-03 01:35:21 -0800</date>
            <delta_ts>2011-12-04 00:03:51 -0800</delta_ts>
            <desc>Patch</desc>
            <filename>bug-73737-20111203013520.patch</filename>
            <type>text/plain</type>
            <size>2004</size>
            <attacher name="Ryosuke Niwa">rniwa</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9XZWJDb3JlL0NoYW5nZUxvZwo9PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBTb3VyY2UvV2Vi
Q29yZS9DaGFuZ2VMb2cJKHJldmlzaW9uIDEwMTkxNykKKysrIFNvdXJjZS9XZWJDb3JlL0NoYW5n
ZUxvZwkod29ya2luZyBjb3B5KQpAQCAtMSwzICsxLDIwIEBACisyMDExLTEyLTAzICBSeW9zdWtl
IE5pd2EgIDxybml3YUB3ZWJraXQub3JnPgorCisgICAgICAgIEhJRVJBUkNIWV9SRVFVRVNUX0VS
UiBjaGVjayBpbiBjaGVja0FjY2VwdENoaWxkIHNob3VsZCBiZSBvcHRpbWl6ZWQgZm9yIG5ld0No
aWxkIHdpdGhvdXQgY2hpbGRyZW4KKyAgICAgICAgaHR0cHM6Ly9idWdzLndlYmtpdC5vcmcvc2hv
d19idWcuY2dpP2lkPTczNzM3CisKKyAgICAgICAgUmV2aWV3ZWQgYnkgTk9CT0RZIChPT1BTISku
CisKKyAgICAgICAgSXQgdHVybmVkIG91dCB0aGF0IG1vc3Qgb2Ygbm9kZXMgaW5zZXJ0ZWQgYnkg
RE9NIEFQSXMgc3VjaCBhcyBpbnNlcnRCZWZvcmUgYW5kIGFwcGVuZENoaWxkCisgICAgICAgIGRv
bid0IGhhdmUgYW55IGNoaWxkcmVuLiBPcHRpbWl6ZSBpc0Rlc2NlbmRhbnRPZiB3aGljaCBpcyB1
c2VkIGJ5IGNoZWNrQWNjZXB0Q2hpbGQgZm9yIHRoaXMgY2FzZS4KKyAgICAgICAgT24gYSB0ZXN0
IGNhc2UgYXR0YWNoZWQgb24gdGhlIGJ1Zywgd2Ug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ID09IG90aGVyLT5kb2N1bWVu
dCgpKQorICAgICAgICByZXR1cm4gZG9jdW1lbnQoKSA9PSBvdGhlciAmJiB0aGlzICE9IGRvY3Vt
ZW50KCkgJiYgaW5Eb2N1bWVudCgpOwogICAgIGZvciAoY29uc3QgQ29udGFpbmVyTm9kZSogbiA9
IHBhcmVudE5vZGUoKTsgbjsgbiA9IG4tPnBhcmVudE5vZGUoKSkgewogICAgICAgICBpZiAobiA9
PSBvdGhlcikKICAgICAgICAgICAgIHJldHVybiB0cnVlOwpAQCAtMTM2MSw4ICsxMzYzLDYgQEAg
Ym9vbCBOb2RlOjpjb250YWlucyhjb25zdCBOb2RlKiBub2RlKSBjbwogewogICAgIGlmICghbm9k
ZSkKICAgICAgICAgcmV0dXJuIGZhbHNlOwotICAgIGlmIChkb2N1bWVudCgpID09IHRoaXMpCi0g
ICAgICAgIHJldHVybiBub2RlLT5kb2N1bWVudCgpID09IHRoaXMgJiYgbm9kZS0+aW5Eb2N1bWVu
dCgpOwogICAgIHJldHVybiB0aGlzID09IG5vZGUgfHwgbm9kZS0+aXNEZXNjZW5kYW50T2YodGhp
cyk7CiB9CiAK
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>117784</attachid>
            <date>2011-12-04 00:03:54 -0800</date>
            <delta_ts>2011-12-04 13:53:13 -0800</delta_ts>
            <desc>Also implement arv&apos;s optimization</desc>
            <filename>bug-73737-20111204000353.patch</filename>
            <type>text/plain</type>
            <size>2364</size>
            <attacher name="Ryosuke Niwa">rniwa</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9XZWJDb3JlL0NoYW5nZUxvZwo9PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBTb3VyY2UvV2Vi
Q29yZS9DaGFuZ2VMb2cJKHJldmlzaW9uIDEwMTkxNykKKysrIFNvdXJjZS9XZWJDb3JlL0No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VyIHx8ICFvdGhlci0+Zmlyc3RDaGlsZCgpIHx8IGluRG9jdW1lbnQoKSAhPSBv
dGhlci0+aW5Eb2N1bWVudCgpKQogICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgaWYgKG90aGVy
ID09IG90aGVyLT5kb2N1bWVudCgpKQorICAgICAgICByZXR1cm4gZG9jdW1lbnQoKSA9PSBvdGhl
ciAmJiB0aGlzICE9IGRvY3VtZW50KCkgJiYgaW5Eb2N1bWVudCgpOwogICAgIGZvciAoY29uc3Qg
Q29udGFpbmVyTm9kZSogbiA9IHBhcmVudE5vZGUoKTsgbjsgbiA9IG4tPnBhcmVudE5vZGUoKSkg
ewogICAgICAgICBpZiAobiA9PSBvdGhlcikKICAgICAgICAgICAgIHJldHVybiB0cnVlOwpAQCAt
MTM2MSw4ICsxMzYzLDYgQEAgYm9vbCBOb2RlOjpjb250YWlucyhjb25zdCBOb2RlKiBub2RlKSBj
bwogewogICAgIGlmICghbm9kZSkKICAgICAgICAgcmV0dXJuIGZhbHNlOwotICAgIGlmIChkb2N1
bWVudCgpID09IHRoaXMpCi0gICAgICAgIHJldHVybiBub2RlLT5kb2N1bWVudCgpID09IHRoaXMg
JiYgbm9kZS0+aW5Eb2N1bWVudCgpOwogICAgIHJldHVybiB0aGlzID09IG5vZGUgfHwgbm9kZS0+
aXNEZXNjZW5kYW50T2YodGhpcyk7CiB9CiAK
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>117785</attachid>
            <date>2011-12-04 01:14:12 -0800</date>
            <delta_ts>2011-12-04 01:14:12 -0800</delta_ts>
            <desc>new perf test</desc>
            <filename>insert-node-perf.html</filename>
            <type>text/html</type>
            <size>1239</size>
            <attacher name="Ryosuke Niwa">rniwa</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIGh0bWw+CjxodG1sPgo8Ym9keT4KPHVsPgo8bGk+U2hhbGxvdyB0cmVlOiA8c3Bh
biBpZD0ic2hhbGxvdyI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