Skip to content

Commit

Permalink
Merge pull request #133 from notandrewdev/main
Browse files Browse the repository at this point in the history
  • Loading branch information
aidenybai authored Oct 10, 2021
2 parents 27e0e2e + d7192e7 commit 30e242f
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 0 deletions.
4 changes: 4 additions & 0 deletions benchmarks/suites/appendManyRowsToLargeTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { createElement, patch } from '../../src/index';
import { Suite } from '../benchmark';
import { buildData } from '../data';
import * as tiny_vdom from '../tiny-vdom';
import * as virtual_dom from 'virtual-dom';

const data = buildData(10000);
const createVNode = () => (
Expand All @@ -31,6 +32,9 @@ const suite = Suite('append many rows to large table (appending 1,000 to a table
'tiny-vdom': () => {
tiny_vdom.patch(el(), vnode, oldVNode);
},
'virtual-dom': () => {
virtual_dom.patch(el(), vnode, oldVNode);
},
DOM: () => {
const elClone = el();
[...data].slice(-1000).forEach(({ id, label }) => {
Expand Down
4 changes: 4 additions & 0 deletions benchmarks/suites/clearRows.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { createElement, patch } from '../../src/index';
import { Suite } from '../benchmark';
import { buildData } from '../data';
import * as tiny_vdom from '../tiny-vdom';
import * as virtual_dom from 'virtual-dom';

const data = buildData(1000);
const oldVNode = (
Expand All @@ -29,6 +30,9 @@ const suite = Suite('clear rows (clearing a table with 1,000 rows)', {
'tiny-vdom': () => {
tiny_vdom.patch(el(), vnode, oldVNode);
},
'virtual-dom': () => {
virtual_dom.patch(el(), vnode, oldVNode);
},
DOM: () => {
const elClone = el();
elClone.childNodes.forEach((child) => elClone.removeChild(child));
Expand Down
4 changes: 4 additions & 0 deletions benchmarks/suites/createManyRows.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { createElement, patch } from '../../src/index';
import { Suite } from '../benchmark';
import { buildData } from '../data';
import * as tiny_vdom from '../tiny-vdom';
import * as virtual_dom from 'virtual-dom';

const data = buildData(10000);
const oldVNode = <table></table>;
Expand All @@ -29,6 +30,9 @@ const suite = Suite('create many rows (creating 10,000 rows)', {
'tiny-vdom': () => {
tiny_vdom.patch(el(), vnode, oldVNode);
},
'virtual-dom': () => {
virtual_dom.patch(el(), vnode, oldVNode)
},
DOM: () => {
const elClone = el();
data.forEach(({ id, label }) => {
Expand Down
4 changes: 4 additions & 0 deletions benchmarks/suites/createRows.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { createElement, patch } from '../../src/index';
import { Suite } from '../benchmark';
import { buildData } from '../data';
import * as tiny_vdom from '../tiny-vdom';
import * as virtual_dom from 'virtual-dom';

const data = buildData(10000);
const oldVNode = <table></table>;
Expand All @@ -29,6 +30,9 @@ const suite = Suite('create rows (creating 1,000 rows)', {
'tiny-vdom': () => {
tiny_vdom.patch(el(), vnode, oldVNode);
},
'virtual-dom': () => {
virtual_dom.patch(el(), vnode, oldVNode);
},
DOM: () => {
const elClone = el();
data.forEach(({ id, label }) => {
Expand Down
4 changes: 4 additions & 0 deletions benchmarks/suites/partialUpdate.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { createElement, patch, UPDATE } from '../../src/index';
import { Suite } from '../benchmark';
import { buildData } from '../data';
import * as tiny_vdom from '../tiny-vdom';
import * as virtual_dom from 'virtual-dom';

const data = buildData(1000);
const oldVNode = (
Expand Down Expand Up @@ -44,6 +45,9 @@ const suite = Suite('partial update (updating every 10th row for 1,000 rows)', {
'tiny-vdom': () => {
tiny_vdom.patch(el(), vnode, oldVNode);
},
'virtual-dom': () => {
virtual_dom.patch(el(), vnode, oldVNode);
},
DOM: () => {
const elClone = el();
for (let i = 0; i < 1000; i += 10) {
Expand Down
4 changes: 4 additions & 0 deletions benchmarks/suites/removeRow.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { createElement, DELETE, patch } from '../../src/index';
import { Suite } from '../benchmark';
import { buildData } from '../data';
import * as tiny_vdom from '../tiny-vdom';
import * as virtual_dom from 'virtual-dom';

const data = buildData(1000);
const oldVNode = (
Expand Down Expand Up @@ -41,6 +42,9 @@ const suite = Suite('remove row (removing one row)', {
'tiny-vdom': () => {
tiny_vdom.patch(el(), vnode, oldVNode);
},
'virtual-dom': () => {
virtual_dom.patch(el(), vnode, oldVNode);
},
DOM: () => {
const elClone = el();
elClone.removeChild(elClone.childNodes[row]);
Expand Down
4 changes: 4 additions & 0 deletions benchmarks/suites/replaceAllRows.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { createElement, patch } from '../../src/index';
import { Suite } from '../benchmark';
import { buildData } from '../data';
import * as tiny_vdom from '../tiny-vdom';
import * as virtual_dom from 'virtual-dom';

const shuffleArray = (array) => {
for (
Expand Down Expand Up @@ -44,6 +45,9 @@ const suite = Suite('replace all rows (updating all 1,000 rows)', {
'tiny-vdom': () => {
tiny_vdom.patch(el(), vnode, oldVNode);
},
'virtual-dom': () => {
virtual_dom.patch(el(), vnode, oldVNode);
},
DOM: () => {
el().childNodes.forEach((tr, i) => {
const { id, label } = data[i];
Expand Down
4 changes: 4 additions & 0 deletions benchmarks/suites/selectRow.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { createElement, patch } from '../../src/index';
import { Suite } from '../benchmark';
import { buildData } from '../data';
import * as tiny_vdom from '../tiny-vdom';
import * as virtual_dom from 'virtual-dom';

const data = buildData(1000);
const createVNode = () => (
Expand All @@ -31,6 +32,9 @@ const suite = Suite('select row (highlighting a selected row)', {
'tiny-vdom': () => {
tiny_vdom.patch(el(), vnode, oldVNode);
},
'virtual-dom': () => {
virtual_dom.patch(el(), vnode, oldVNode);
},
DOM: () => {
el().childNodes[row].style.background = 'red';
},
Expand Down
4 changes: 4 additions & 0 deletions benchmarks/suites/swapRows.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { createElement, patch, UPDATE } from '../../src/index';
import { Suite } from '../benchmark';
import { buildData } from '../data';
import * as tiny_vdom from '../tiny-vdom';
import * as virtual_dom from 'virtual-dom';

const data = buildData(1000);
const oldVNode = (
Expand Down Expand Up @@ -45,6 +46,9 @@ const suite = Suite('swap rows (swap 2 rows for table with 1,000 rows)', {
'tiny-vdom': () => {
tiny_vdom.patch(el(), vnode, oldVNode);
},
'virtual-dom': () => {
virtual_dom.patch(el(), vnode, oldVNode);
},
DOM: () => {
const elClone = el();
const tr1 = elClone.childNodes[row1];
Expand Down

0 comments on commit 30e242f

Please sign in to comment.