Skip to content

Commit

Permalink
Merge pull request #89 from aidenybai/scheduler
Browse files Browse the repository at this point in the history
fix: benchmarks not using the correct compiler flags
  • Loading branch information
aidenybai authored Jul 26, 2021
2 parents 74e9de1 + 5ed8ea9 commit fd2c1b2
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 18 deletions.
24 changes: 18 additions & 6 deletions benchmarks/conditional-render.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ const conditionalRender = (() => {
const benchmark = suite
.add('million', {
setup() {
document.body.innerHTML = '<b>conditional-render</b>: Running <code>million</code> benchmarks... (Check console for realtime results)';
document.body.innerHTML =
'<b>conditional-render</b>: Running <code>million</code> benchmarks... (Check console for realtime results)';
const el = Million.createElement(Million.m('div', { id: 'app' }));
document.body.appendChild(el);
app = el;
Expand All @@ -16,13 +17,19 @@ const conditionalRender = (() => {
const hasChildren = timestamp % 2 === 0;
Million.patch(
app,
Million.m('div', { id: 'app' }, hasChildren ? [String(timestamp)] : undefined, hasChildren ? 1 : 0),
Million.m(
'div',
{ id: 'app' },
hasChildren ? [String(timestamp)] : undefined,
hasChildren ? 1 << 1 : 1 << 0,
),
);
},
})
.add('virtual-dom', {
setup() {
document.body.innerHTML = '<b>conditional-render</b>: Running <code>virtual-dom</code> benchmarks... (Check console for realtime results)';
document.body.innerHTML =
'<b>conditional-render</b>: Running <code>virtual-dom</code> benchmarks... (Check console for realtime results)';
const vnode = virtualDom.h('div', {
id: 'app',
});
Expand All @@ -46,7 +53,8 @@ const conditionalRender = (() => {
})
.add('vanilla', {
setup() {
document.body.innerHTML = '<b>conditional-render</b>: Running <code>vanilla</code> benchmarks... (Check console for realtime results)';
document.body.innerHTML =
'<b>conditional-render</b>: Running <code>vanilla</code> benchmarks... (Check console for realtime results)';
const el = document.createElement('div');
el.id = 'app';
document.body.appendChild(el);
Expand All @@ -68,7 +76,8 @@ const conditionalRender = (() => {
})
.add('baseline', {
setup() {
document.body.innerHTML = '<b>conditional-render</b>: Running <code>baseline</code> benchmarks... (Check console for realtime results)';
document.body.innerHTML =
'<b>conditional-render</b>: Running <code>baseline</code> benchmarks... (Check console for realtime results)';
const el = document.createElement('div');
el.id = 'app';
document.body.appendChild(el);
Expand All @@ -83,7 +92,10 @@ const conditionalRender = (() => {
output += `${String(target)}<br />`;
})
.on('complete', () => {
const message = `<i>Fastest is <b>${benchmark.filter('fastest').map('name').join(', ')}</b></i>`;
const message = `<i>Fastest is <b>${benchmark
.filter('fastest')
.map('name')
.join(', ')}</b></i>`;
console.log(message);
output += `${message}<br /><br />`;
output += `<button onclick="window.location.reload()">Reload</button><br />`;
Expand Down
24 changes: 18 additions & 6 deletions benchmarks/list-render.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,27 @@ const listRender = (() => {
.add('million', {
setup() {
children = [];
document.body.innerHTML = '<b>list-render</b>: Running <code>million</code> benchmarks... (Check console for realtime results)';
document.body.innerHTML =
'<b>list-render</b>: Running <code>million</code> benchmarks... (Check console for realtime results)';
const el = Million.createElement(Million.m('div', { id: 'app' }));
document.body.appendChild(el);
app = el;
},
fn() {
children.push(String(Date.now()));
Million.patch(app, Million.m('div', { id: 'app' }, [...children], 1));
Million.patch(
app,
Million.m('div', { id: 'app' }, [...children], 1 << 1, [
Million.INSERT(children.length - 1),
]),
);
},
})
.add('virtual-dom', {
setup() {
children = [];
document.body.innerHTML = '<b>list-render</b>: Running <code>virtual-dom</code> benchmarks... (Check console for realtime results)';
document.body.innerHTML =
'<b>list-render</b>: Running <code>virtual-dom</code> benchmarks... (Check console for realtime results)';
const vnode = virtualDom.h('div', {
id: 'app',
});
Expand All @@ -47,7 +54,8 @@ const listRender = (() => {
.add('vanilla', {
setup() {
children = [];
document.body.innerHTML = '<b>list-render</b>: Running <code>vanilla</code> benchmarks... (Check console for realtime results)';
document.body.innerHTML =
'<b>list-render</b>: Running <code>vanilla</code> benchmarks... (Check console for realtime results)';
const el = document.createElement('div');
el.id = 'app';
document.body.appendChild(el);
Expand All @@ -72,7 +80,8 @@ const listRender = (() => {
.add('baseline', {
setup() {
children = [];
document.body.innerHTML = '<b>list-render</b>: Running <code>baseline</code> benchmarks... (Check console for realtime results)';
document.body.innerHTML =
'<b>list-render</b>: Running <code>baseline</code> benchmarks... (Check console for realtime results)';
const el = document.createElement('div');
el.id = 'app';
document.body.appendChild(el);
Expand All @@ -87,7 +96,10 @@ const listRender = (() => {
output += `${String(target)}<br />`;
})
.on('complete', () => {
const message = `<i>Fastest is <b>${benchmark.filter('fastest').map('name').join(', ')}</b></i>`;
const message = `<i>Fastest is <b>${benchmark
.filter('fastest')
.map('name')
.join(', ')}</b></i>`;
console.log(message);
output += `${message}<br /><br />`;
output += `<button onclick="window.location.reload()">Reload</button><br />`;
Expand Down
19 changes: 13 additions & 6 deletions benchmarks/text-interop.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,20 @@ const textInterop = (() => {
const benchmark = suite
.add('million', {
setup() {
document.body.innerHTML = '<b>text-interop</b>: Running <code>million</code> benchmarks... (Check console for realtime results)';
document.body.innerHTML =
'<b>text-interop</b>: Running <code>million</code> benchmarks... (Check console for realtime results)';
const el = Million.createElement(Million.m('div', { id: 'app' }));
document.body.appendChild(el);
app = el;
},
fn() {
Million.patch(app, Million.m('div', { id: 'app' }, [Date.now()], 1));
Million.patch(app, Million.m('div', { id: 'app' }, [Date.now()], 1 << 1));
},
})
.add('virtual-dom', {
setup() {
document.body.innerHTML = '<b>text-interop</b>: Running <code>virtual-dom</code> benchmarks... (Check console for realtime results)';
document.body.innerHTML =
'<b>text-interop</b>: Running <code>virtual-dom</code> benchmarks... (Check console for realtime results)';
const vnode = virtualDom.h('div', {
id: 'app',
});
Expand All @@ -41,7 +43,8 @@ const textInterop = (() => {
})
.add('vanilla', {
setup() {
document.body.innerHTML = '<b>text-interop</b>: Running <code>vanilla</code> benchmarks... (Check console for realtime results)';
document.body.innerHTML =
'<b>text-interop</b>: Running <code>vanilla</code> benchmarks... (Check console for realtime results)';
const el = document.createElement('div');
el.id = 'app';
document.body.appendChild(el);
Expand All @@ -63,7 +66,8 @@ const textInterop = (() => {
})
.add('baseline', {
setup() {
document.body.innerHTML = '<b>text-interop</b>: Running <code>baseline</code> benchmarks... (Check console for realtime results)';
document.body.innerHTML =
'<b>text-interop</b>: Running <code>baseline</code> benchmarks... (Check console for realtime results)';
const el = document.createElement('div');
el.id = 'app';
document.body.appendChild(el);
Expand All @@ -78,7 +82,10 @@ const textInterop = (() => {
output += `${String(target)}<br />`;
})
.on('complete', () => {
const message = `<i>Fastest is <b>${benchmark.filter('fastest').map('name').join(', ')}</b></i>`;
const message = `<i>Fastest is <b>${benchmark
.filter('fastest')
.map('name')
.join(', ')}</b></i>`;
console.log(message);
output += `${message}<br /><br />`;
output += `<button onclick="window.location.reload()">Reload</button><br />`;
Expand Down

0 comments on commit fd2c1b2

Please sign in to comment.