Files
react-native-web/performance/benchmarks/deepTree/index.js
Nicolas Gallagher a2cafe56fc Add initial performance benchmarks
Simple render tree benchmarks originally developed by @lelandrichardson

Fix #306
2017-01-01 14:43:47 -08:00

25 lines
753 B
JavaScript

import benchmark from '../../benchmark';
import createDeepTree from './createDeepTree';
import React from 'react';
import ReactDOM from 'react-dom';
import ReactNative from 'react-native';
// React Native for Web implementation of the tree
const DeepTree = createDeepTree(ReactNative);
const deepTreeBenchmark = ({ breadth, depth, wrap, runs }, node) => () => {
const setup = () => { };
const teardown = () => ReactDOM.unmountComponentAtNode(node);
return benchmark({
name: 'DeepTree',
description: `depth=${depth}, breadth=${breadth}, wrap=${wrap})`,
runs,
setup,
teardown,
task: () => ReactDOM.render(<DeepTree breadth={breadth} depth={depth} id={0} wrap={wrap} />, node)
});
};
module.exports = deepTreeBenchmark;