Skip to content

Commit

Permalink
[benchmark] Fix not running (#16900)
Browse files Browse the repository at this point in the history
  • Loading branch information
ypresto authored and joshwooding committed Aug 6, 2019
1 parent dc740b6 commit ba2b44c
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 6 deletions.
12 changes: 12 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,17 @@ module.exports = {
],
],
},
benchmark: {
plugins: [
...productionPlugins,
[
'babel-plugin-module-resolver',
{
root: ['./'],
alias: defaultAlias,
},
],
],
},
},
};
10 changes: 5 additions & 5 deletions packages/material-ui-benchmark/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
},
"homepage": "https://github.com/mui-org/material-ui/tree/master/packages/material-ui-benchmark",
"scripts": {
"core": "cd ../../ && NODE_ENV=production BABEL_ENV=docs-production babel-node packages/material-ui-benchmark/src/core.js --inspect=0.0.0.0:9229",
"docs": "cd ../../ && NODE_ENV=production BABEL_ENV=docs-production babel-node packages/material-ui-benchmark/src/docs.js --inspect=0.0.0.0:9229",
"server": "cd ../../ && NODE_ENV=production BABEL_ENV=docs-production babel-node packages/material-ui-benchmark/src/server.js --inspect=0.0.0.0:9229",
"styles": "cd ../../ && NODE_ENV=production BABEL_ENV=docs-production babel-node packages/material-ui-benchmark/src/styles.js --inspect=0.0.0.0:9229",
"system": "cd ../../ && NODE_ENV=production BABEL_ENV=docs-production babel-node packages/material-ui-benchmark/src/system.js --inspect=0.0.0.0:9229",
"core": "cd ../../ && NODE_ENV=production BABEL_ENV=benchmark babel-node packages/material-ui-benchmark/src/core.js --inspect=0.0.0.0:9229",
"docs": "cd ../../ && NODE_ENV=production BABEL_ENV=benchmark babel-node packages/material-ui-benchmark/src/docs.js --inspect=0.0.0.0:9229",
"server": "cd ../../ && NODE_ENV=production BABEL_ENV=benchmark babel-node packages/material-ui-benchmark/src/server.js --inspect=0.0.0.0:9229",
"styles": "cd ../../ && NODE_ENV=production BABEL_ENV=benchmark babel-node packages/material-ui-benchmark/src/styles.js --inspect=0.0.0.0:9229",
"system": "cd ../../ && NODE_ENV=production BABEL_ENV=benchmark babel-node packages/material-ui-benchmark/src/system.js --inspect=0.0.0.0:9229",
"test": "exit 0"
},
"engines": {
Expand Down
14 changes: 13 additions & 1 deletion packages/material-ui-benchmark/src/docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import React from 'react';
import ReactDOMServer from 'react-dom/server';
import MarkdownElement from 'docs/src/modules/components/MarkdownElement';
import Markdown from 'docs/src/pages/getting-started/templates/blog/Markdown';
import { createStore } from 'redux';
import { Provider } from 'react-redux';

const suite = new Benchmark.Suite('core', {
onError: event => {
Expand All @@ -20,12 +22,22 @@ const markdown = fs.readFileSync(
'UTF-8',
);

const store = createStore(state => state, {
options: {
userLanguage: 'en',
},
});

suite
.add('Markdown', () => {
ReactDOMServer.renderToString(<Markdown>{markdown}</Markdown>);
})
.add('MarkdownElement', () => {
ReactDOMServer.renderToString(<MarkdownElement text={markdown} />);
ReactDOMServer.renderToString(
<Provider store={store}>
<MarkdownElement text={markdown} />
</Provider>,
);
})
.on('cycle', event => {
console.log(String(event.target));
Expand Down

0 comments on commit ba2b44c

Please sign in to comment.