Skip to content

Instantly share code, notes, and snippets.

@neonstalwart
Forked from dylans/dylan.profile.js
Created May 30, 2012 21:26
Show Gist options
  • Save neonstalwart/2839070 to your computer and use it in GitHub Desktop.
Save neonstalwart/2839070 to your computer and use it in GitHub Desktop.
Build profile draft
function copyOnly(mid) {
return (/test/.test(mid) && mid !== 'dgrid/test/data/perf') || mid in {
// There are no modules right now in dojo boilerplate that are copy-only. If you have some, though, just add
// them here like this:
// 'app/module': 1
};
}
var profile = {
basePath: './',
releaseDir: "./release/dgrid",
packages: [
'dojo',
'dijit',
{
name: "dgrid",
resourceTags: {
// Files that contain test code.
test: function (filename, mid) {
// any filename that has test anywhere in its path will be considered a test
return copyOnly(mid);
},
// Files that should be copied as-is without being modified by the build system.
copyOnly: function (filename, mid) {
return copyOnly(mid);
},
// Files that are AMD modules.
amd: function (filename, mid) {
return !copyOnly(mid) && /\.js$/.test(filename);
}
}
},
{
name: "xstyle",
resourceTags: {
// Files that contain test code.
test: function (filename, mid) {
return copyOnly(mid);
},
// Files that should be copied as-is without being modified by the build system.
copyOnly: function (filename, mid) {
return copyOnly(mid);
},
// Files that are AMD modules.
amd: function (filename, mid) {
return !copyOnly(mid) && /\.js$/.test(filename);
}
}
},
{
name: "put-selector",
resourceTags: {
// Files that contain test code.
test: function (filename, mid) {
return copyOnly(mid);
},
// Files that should be copied as-is without being modified by the build system.
copyOnly: function (filename, mid) {
return copyOnly(mid);
},
// Files that are AMD modules.
amd: function (filename, mid) {
return !copyOnly(mid) && /\.js$/.test(filename);
}
}
}
],
cssOptimize: 'comments',
// include the tests for now
mini: false,
optimize: 'closure',
stripConsole: 'all',
selectorEngine: 'lite',
layers: {
'dojo/dojo': {
include: ['dojo/dojo', 'dojo/domReady', 'dojo/_base/declare'],
boot: true,
customBase: true
},
'dgrid/dgrid': {
include: ["dgrid/List", "dgrid/OnDemandGrid", "dgrid/Selection", "dgrid/Keyboard", "dgrid/test/data/perf"]
}
},
staticHasFeatures: {
// The trace & log APIs are used for debugging the loader, so we don’t need them in the build
'dojo-trace-api': 0,
'dojo-log-api': 0,
// This causes normally private loader data to be exposed for debugging, so we don’t need that either
'dojo-publish-privates': 0,
// We’re fully async, so get rid of the legacy loader
'dojo-sync-loader': 0,
// We aren’t loading tests in production
'dojo-test-sniff': 0
}
};
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Test Performance</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="viewport" content="width=570" />
<style type="text/css">
@import "../../dojo/resources/dojo.css";
@import "../css/dgrid.css";
@import "../css/skins/tundra.css";
.heading {
font-weight: bold;
margin-left: 12px;
padding-bottom: 0.25em;
}
.ui-widget{
margin: 10px;
}
/* this is not part of theme, but you can add odd-even coloring this way*/
.dgrid-row-odd {
background: #F2F5F9;
}
#grid {
width: 68em;
height: 50em;
padding: 1px;
}
</style>
<script type="text/javascript" src="../../dojo/dojo.js"
data-dojo-config="async: true"></script>
<script type="text/javascript">
require(['dgrid/dgrid'], function () {
require(["dgrid/List", "dgrid/OnDemandGrid","dgrid/Selection", "dgrid/Keyboard", "dojo/_base/declare", "dgrid/test/data/perf", "dojo/domReady!"],
function(List, Grid, Selection, Keyboard, declare, testPerfStore){
var columns = [
{ name: 'Column 0', field: 'id', width: '10%' },
{ name: 'Column 1', field: 'integer', width: '10%' },
{ name: 'Column 2', field: 'floatNum', width: '10%' },
{ name: 'Column 3', field: 'date', width: '10%' },
{ name: 'Column 4', field: 'date2', width: '10%' },
{ name: 'Column 5', field: 'text', width: '10%' },
{ name: 'Column 6', field: 'bool', width: '10%' },
{ name: 'Column 7', field: 'bool2', width: '10%' },
{ name: 'Column 8', field: 'price', width: '10%' },
{ name: 'Column 9', field: 'today', width: '10%' }
];
var start = new Date().getTime();
window.grid = new (declare([Grid, Selection, Keyboard]))({
store: testPerfStore,
columns: columns
}, "grid");
console.log("startup time", new Date().getTime() - start);
var processScroll = grid._processScroll;
grid._processScroll = function(){
var start = new Date().getTime();
processScroll.call(this);
console.log("scroll time", new Date().getTime() - start);
};
});
})
</script>
</head>
<body class="tundra">
<h2 class="heading">A performance test designed to go head to head with DataGrid's test_datagrid_performance.html</h2>
<div id="grid"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment