@@ -891,15 +891,34 @@ fn create(
891891 } else {
892892 change_list.create_element(tag_name);
893893 }
894+
894895 for l in listeners {
895896 unsafe {
896897 registry.add(l);
897898 }
898899 change_list.new_event_listener(l);
899900 }
901+
900902 for attr in attributes {
901903 change_list.set_attribute(&attr.name, &attr.value);
902904 }
905+
906+ // Fast path: if there is a single text child, it is faster to
907+ // create-and-append the text node all at once via setting the
908+ // parent's `textContent` in a single change list instruction than
909+ // to emit three instructions to (1) create a text node, (2) set its
910+ // text content, and finally (3) append the text node to this
911+ // parent.
912+ if children.len() == 1 {
913+ if let Node {
914+ kind: NodeKind::Text(TextNode { text }),
915+ } = children[0]
916+ {
917+ change_list.set_text(text);
918+ return;
919+ }
920+ }
921+
903922 for child in children {
904923 create(cached_set, change_list, registry, child, cached_roots);
905924 change_list.append_child();