Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ab89ea1
commit 1f5986c
Showing
91 changed files
with
4,785 additions
and
2,065 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
*.marko.js | ||
/node_modules | ||
/static | ||
/.cache | ||
/build | ||
/.cache | ||
.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"dependencies": [ | ||
"lodash/lodash.js", | ||
"benchmark/benchmark.js", | ||
"require: ./components/app", | ||
"require-run: ./client", | ||
"require-run: ../benchmarks/*/client.js" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
var helpers = require('./helpers'); | ||
|
||
function addBench(libName, factoryFunc) { | ||
var benchmark = exports.benchmark; | ||
var bench = benchmark.createBench(libName, factoryFunc); | ||
benchmark.benches[libName] = bench; | ||
} | ||
|
||
function registerBenchmark(factoryFunc) { | ||
var benchmark = factoryFunc(helpers); | ||
benchmark.benches = {}; | ||
exports.benchmark = benchmark; | ||
} | ||
|
||
if (typeof window !== 'undefined') { | ||
window.addBench = addBench; | ||
window.registerBenchmark = registerBenchmark; | ||
window.onMount = function() {}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<div> | ||
<button type="button" onClick("handleBenchmarkButtonClick")> | ||
Run benchmark: ${state.benchmarkName} | ||
</button> | ||
|
||
<pre ref="results" style="width: 100%; border: 1px solid black;" no-update/> | ||
|
||
<div#mount> | ||
|
||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<script> | ||
module.exports = { | ||
}; | ||
</script> | ||
|
||
<div.mount-container ref="foo"> | ||
<h1>${data.libName}</h1> | ||
<div> | ||
<div ref="output"> | ||
</div> | ||
</div> | ||
</div> |
3 changes: 2 additions & 1 deletion
3
.../pages/benchmark/components/app/style.css → ...ient/components/mount-container/style.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
.benchmark-container { | ||
.mount-container { | ||
height: 600px; | ||
width: 300px; | ||
overflow: scroll; | ||
display: inline-block; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
var template = require('./page.marko'); | ||
|
||
var isProduction = process.env.NODE_ENV === 'production'; | ||
|
||
function createRoute(benchmark, routeOptions) { | ||
var bundles = []; | ||
benchmark.benches.forEach((bench) => { | ||
// if (bench.name !== 'marko') { | ||
// return; | ||
// } | ||
bundles.push(`/build/${benchmark.name}/bundles${isProduction ? '.min' : ''}/${bench.name}.js`); | ||
}); | ||
|
||
return function(req, res) { | ||
res.marko(template, { | ||
$global: { | ||
benchmark | ||
}, | ||
bundles | ||
}); | ||
}; | ||
} | ||
|
||
module.exports = createRoute; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
var mountContainer = require('./components/mount-container'); | ||
|
||
var mountEls = {}; | ||
|
||
function createMountEl(libName) { | ||
var key = libName; | ||
var mountWidget = mountContainer.renderSync({ | ||
libName: libName | ||
}) | ||
.appendTo(document.getElementById('mount')) | ||
.getWidget(); | ||
|
||
mountEls[key] = mountWidget.el; | ||
|
||
return mountWidget.getEl('output'); | ||
} | ||
|
||
function showSingleMountEl(libName) { | ||
var key = libName; | ||
|
||
for (var curKey in mountEls) { | ||
var mountEl = mountEls[curKey]; | ||
if (curKey === key) { | ||
mountEl.style.display = 'inline-block'; | ||
} else { | ||
mountEl.style.display = 'none'; | ||
} | ||
} | ||
} | ||
|
||
function showMountEl(libName) { | ||
var key = libName; | ||
|
||
var mountEl = mountEls[key]; | ||
mountEl.style.display = 'inline-block'; | ||
} | ||
|
||
exports.createMountEl = createMountEl; | ||
exports.showSingleMountEl = showSingleMountEl; | ||
exports.showMountEl = showMountEl; |
14 changes: 11 additions & 3 deletions
14
src/shared/pages/benchmark/template.marko → benchmark-client/page.marko
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.