<commit_before>import '../src/index';
import benchmark from 'birdpoo';

describe('add / remove', () => {
  const div = document.createElement.bind(document, 'div');

  function fn(elem) {
    const ch = div();
    const el = elem;
    el.appendChild(ch);
    el.removeChild(ch);
  }

  benchmark(() => {
    const elem = div();
    fn(elem);
  }).then((opsPerSec) => {
    console.log('native: ', opsPerSec);
  });

  benchmark(() => {
    const elem = div();
    elem.attachShadow({ mode: 'closed' });
    fn(elem);
  }).then((opsPerSec) => {
    console.log('prollyfill (no slot): ', opsPerSec);
  });

  benchmark(() => {
    const elem = div();
    const root = elem.attachShadow({ mode: 'closed' });
    root.innerHTML = '<slot></slot>';
    fn(elem);
  }).then((opsPerSec) => {
    console.log('prollyfill (default slot): ', opsPerSec);
  });
});<commit_msg>feat: added native test<commit_after>import '../src/index';
import benchmark from 'birdpoo';

describe('add / remove', () => {
  const div = document.createElement.bind(document, 'div');

  function fn(elem) {
    const ch = div();
    const el = elem;
    el.appendChild(ch);
    el.removeChild(ch);
  }

  function fn_native(elem) {
    const ch = div();
    const el = elem;
    el.__appendChild(ch);
    el.__removeChild(ch);
  }


  benchmark(() => {
    const elem = div();
    fn_native(elem);
  }).then((opsPerSec) => {
    console.log('native: ', opsPerSec);
  });

  benchmark(() => {
    const elem = div();
    fn(elem);
  }).then((opsPerSec) => {
    console.log('polyfilled (no root): ', opsPerSec);
  });

  benchmark(() => {
    const elem = div();
    elem.attachShadow({ mode: 'closed' });
    fn(elem);
  }).then((opsPerSec) => {
    console.log('prolyfill (no slot): ', opsPerSec);
  });

  benchmark(() => {
    const elem = div();
    const root = elem.attachShadow({ mode: 'closed' });
    root.innerHTML = '<slot></slot>';
    fn(elem);
  }).then((opsPerSec) => {
    console.log('prolyfill (default slot): ', opsPerSec);
  });
});
{'fraction_non_alphanumeric': 0.21000495294700347, 'fraction_numerical': 0.0, 'mean_word_length': 3.105691056910569, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2428290', 'n_tokens_mistral': 689, 'n_tokens_neox': 673, 'n_words': 143}