mirror of
https://github.com/zhigang1992/react-native-web.git
synced 2026-04-19 23:40:54 +08:00
Rearrange the benchmark code so that each implementation is self-contained. Adds the SierpinskiTriangle case that 'emotion' introduced in their fork of the 'react-native-web' benchmarks. And make it possible to run benchmarks on a per-library basis.
25 lines
502 B
JavaScript
25 lines
502 B
JavaScript
import benchmark from './benchmark';
|
|
import ReactDOM from 'react-dom';
|
|
|
|
const node = document.querySelector('.root');
|
|
|
|
const createRenderBenchmark = ({ description, getElement, name, runs }) => () => {
|
|
const setup = () => {};
|
|
const teardown = () => {
|
|
ReactDOM.unmountComponentAtNode(node);
|
|
};
|
|
|
|
return benchmark({
|
|
name,
|
|
description,
|
|
runs,
|
|
setup,
|
|
teardown,
|
|
task: () => {
|
|
ReactDOM.render(getElement(), node);
|
|
}
|
|
});
|
|
};
|
|
|
|
export default createRenderBenchmark;
|