Skip to content

Commit

Permalink
domvm-v3.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
leeoniya committed Jul 3, 2017
1 parent 5af62a2 commit c8c58b7
Show file tree
Hide file tree
Showing 11 changed files with 76 additions and 135 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>domvm v2.1.4-keyed</title>
<title>domvm v3.0.0-keyed</title>
<link href="/css/currentStyle.css" rel="stylesheet"/>
</head>
<body>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "js-framework-benchmark-domvm-keyed",
"version": "2.1.4-keyed",
"version": "3.0.0-keyed",
"description": "Benchmark for domvm framework (keyed)",
"scripts": {
"build-dev": "node build.js",
Expand All @@ -13,6 +13,6 @@
"rollup-plugin-uglify": "*"
},
"dependencies": {
"domvm": "git://github.com/leeoniya/domvm.git#eeb3690109fc6515b462bfaef2f81dbcb68a827a"
"domvm": "git://github.com/leeoniya/domvm.git#a05f8fbcd98b6daaea047f52868fb938ceac24b9"
}
}
Original file line number Diff line number Diff line change
@@ -1,29 +1,7 @@
import domvm from '../node_modules/domvm/dist/nano/domvm.nano.min.js';

import {Store} from './store.es6';

let startTime;
let lastMeasure;

function startMeasure(name) {
startTime = performance.now();
lastMeasure = name;
}

function stopMeasure() {
var last = lastMeasure;

if (lastMeasure) {
window.setTimeout(function () {
lastMeasure = null;
var stop = performance.now();
var duration = 0;
console.log(last+" took "+(stop-startTime));
}, 0);
}
}

const h = domvm.defineElement;
const h = (tag, arg1, arg2) => domvm.defineElement(tag, arg1, arg2, domvm.FIXED_BODY);
const v = domvm.defineView;
const store = new Store();

Expand All @@ -41,27 +19,25 @@ function App(vm) {
}

function Jumbotron(vm) {
vm.diff(_ => [0]);
vm.config({diff: _ => 0});

let wrapMeasure = name => e => {
startMeasure(name);
let exec = name => e => {
store[name]();
vm.root().redraw(true);
stopMeasure(name);
vm.root().redraw();
};

let run = wrapMeasure("run");
let runLots = wrapMeasure("runLots");
let add = wrapMeasure("add");
let update = wrapMeasure("update");
let clear = wrapMeasure("clear");
let swapRows = wrapMeasure("swapRows");
let run = exec("run");
let runLots = exec("runLots");
let add = exec("add");
let update = exec("update");
let clear = exec("clear");
let swapRows = exec("swapRows");

return _ =>
h(".jumbotron", [
h(".row", [
h(".col-md-6", [
h("h1", "domvm v2.1.4 (keyed)")
h("h1", "domvm v3.0.0 (keyed)")
]),
h(".col-md-6", [
h(".row", [
Expand Down Expand Up @@ -91,22 +67,18 @@ function Jumbotron(vm) {

function Table(vm) {
let select = (e, node) => {
startMeasure("select");
while (node.key == null)
node = node.parent;
store.select(node.key);
vm.redraw(true); // sync redraw
stopMeasure("select");
vm.redraw();
return false;
};

let remove = (e, node) => {
startMeasure("delete");
while (node.key == null)
node = node.parent;
store.delete(node.key);
vm.redraw(true);
stopMeasure("delete");
vm.redraw();
return false;
};

Expand All @@ -116,28 +88,27 @@ function Table(vm) {
".lbl": select,
};

return _ =>
h("table.table.table-hover.table-striped.test-data", {onclick: tableClick}, [
h("tbody", {_flags: domvm.KEYED_LIST}, store.data.map(item =>
v(Item, item, item.id)
))
]);
}

function Item(vm, item) {
vm.diff((vm, item) => [item.label, item.id === store.selected]);

return _ =>
h("tr", {class: item.id === store.selected ? 'danger' : null}, [
h("td.col-md-1", item.id),
h("td.col-md-4", [
h("a.lbl", item.label)
]),
h("td.col-md-1", [
h("a.remove", [
h("span.glyphicon.glyphicon-remove", {"aria-hidden": ""})
return _ => {
var items = domvm.lazyList(store.data, {
key: item => item.id,
diff: item => [item.label, item.id === store.selected],
});

return h("table.table.table-hover.table-striped.test-data", {onclick: tableClick}, [
h("tbody", {_flags: domvm.LAZY_LIST | domvm.KEYED_LIST}, items.map(item =>
h("tr", {_key: item.id, class: item.id === store.selected ? 'danger' : null}, [
h("td.col-md-1", item.id),
h("td.col-md-4", [
h("a.lbl", item.label)
]),
h("td.col-md-1", [
h("a.remove", [
h("span.glyphicon.glyphicon-remove", {"aria-hidden": ""})
])
]),
h("td.col-md-6")
])
]),
h("td.col-md-6")
))
]);
};
}
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>domvm v2.1.4-non-keyed</title>
<title>domvm v3.0.0-non-keyed</title>
<link href="/css/currentStyle.css" rel="stylesheet"/>
</head>
<body>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "js-framework-benchmark-domvm-non-keyed",
"version": "2.1.4-non-keyed",
"name": "js-framework-benchmark-domvm-keyed",
"version": "3.0.0-non-keyed",
"description": "Benchmark for domvm framework (non-keyed)",
"scripts": {
"build-dev": "node build.js",
Expand All @@ -13,6 +13,6 @@
"rollup-plugin-uglify": "*"
},
"dependencies": {
"domvm": "git://github.com/leeoniya/domvm.git#eeb3690109fc6515b462bfaef2f81dbcb68a827a"
"domvm": "git://github.com/leeoniya/domvm.git#a05f8fbcd98b6daaea047f52868fb938ceac24b9"
}
}
Original file line number Diff line number Diff line change
@@ -1,29 +1,7 @@
import domvm from '../node_modules/domvm/dist/nano/domvm.nano.min.js';

import {Store} from './store.es6';

let startTime;
let lastMeasure;

function startMeasure(name) {
startTime = performance.now();
lastMeasure = name;
}

function stopMeasure() {
var last = lastMeasure;

if (lastMeasure) {
window.setTimeout(function () {
lastMeasure = null;
var stop = performance.now();
var duration = 0;
console.log(last+" took "+(stop-startTime));
}, 0);
}
}

const h = domvm.defineElement;
const h = (tag, arg1, arg2) => domvm.defineElement(tag, arg1, arg2, domvm.FIXED_BODY);
const v = domvm.defineView;
const store = new Store();

Expand All @@ -41,27 +19,25 @@ function App(vm) {
}

function Jumbotron(vm) {
vm.diff(_ => [0]);
vm.config({diff: _ => 0});

let wrapMeasure = name => e => {
startMeasure(name);
let exec = name => e => {
store[name]();
vm.root().redraw(true);
stopMeasure(name);
vm.root().redraw();
};

let run = wrapMeasure("run");
let runLots = wrapMeasure("runLots");
let add = wrapMeasure("add");
let update = wrapMeasure("update");
let clear = wrapMeasure("clear");
let swapRows = wrapMeasure("swapRows");
let run = exec("run");
let runLots = exec("runLots");
let add = exec("add");
let update = exec("update");
let clear = exec("clear");
let swapRows = exec("swapRows");

return _ =>
h(".jumbotron", [
h(".row", [
h(".col-md-6", [
h("h1", "domvm v2.1.4 (non-keyed)")
h("h1", "domvm v3.0.0 (non-keyed)")
]),
h(".col-md-6", [
h(".row", [
Expand Down Expand Up @@ -91,22 +67,18 @@ function Jumbotron(vm) {

function Table(vm) {
let select = (e, node) => {
startMeasure("select");
while (node.data == null)
node = node.parent;
store.select(node.data);
vm.redraw(true); // sync redraw
stopMeasure("select");
vm.redraw();
return false;
};

let remove = (e, node) => {
startMeasure("delete");
while (node.data == null)
node = node.parent;
store.delete(node.data);
vm.redraw(true);
stopMeasure("delete");
vm.redraw();
return false;
};

Expand All @@ -116,28 +88,26 @@ function Table(vm) {
".lbl": select,
};

return _ =>
h("table.table.table-hover.table-striped.test-data", {onclick: tableClick}, [
h("tbody", store.data.map(item =>
v(Item, item, false)
))
]);
}

function Item(vm) {
vm.diff((vm, item) => [item.label, item.id, item.id === store.selected]);

return (vm, item) =>
h("tr", {class: item.id === store.selected ? 'danger' : null, _data: item.id}, [
h("td.col-md-1", item.id),
h("td.col-md-4", [
h("a.lbl", item.label)
]),
h("td.col-md-1", [
h("a.remove", [
h("span.glyphicon.glyphicon-remove", {"aria-hidden": ""})
return _ => {
var items = domvm.lazyList(store.data, {
diff: item => [item.label, item.id === store.selected, item.id],
});

return h("table.table.table-hover.table-striped.test-data", {onclick: tableClick}, [
h("tbody", {_flags: domvm.LAZY_LIST}, items.map(item =>
h("tr", {_data: item.id, class: item.id === store.selected ? 'danger' : null}, [
h("td.col-md-1", item.id),
h("td.col-md-4", [
h("a.lbl", item.label)
]),
h("td.col-md-1", [
h("a.remove", [
h("span.glyphicon.glyphicon-remove", {"aria-hidden": ""})
])
]),
h("td.col-md-6")
])
]),
h("td.col-md-6")
))
]);
};
}
File renamed without changes.
4 changes: 2 additions & 2 deletions webdriver-ts/src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ export let frameworks = [
f("Datum-v0.8.0", true),
f("dio-v7.0.1-keyed", false),
f("dio-v7.0.1-non-keyed", true),
f("domvm-v2.1.4-non-keyed", true),
f("domvm-v2.1.4-keyed", false),
f("domvm-v3.0.0-non-keyed", true),
f("domvm-v3.0.0-keyed", false),
f("ember-v2.13.0", false, {uri: "ember-v2.13.0/dist"}),
f("elm-v0.18.0", false),
f("glimmer-v0.3.10", false, {uri: "glimmer-v0.3.10/dist"}),
Expand Down

0 comments on commit c8c58b7

Please sign in to comment.