main
Last change
on this file since d24f17c was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
1.6 KB
|
Rev | Line | |
---|
[d24f17c] | 1 | var Benchmark;
|
---|
| 2 |
|
---|
| 3 | Benchmark = require('benchmark');
|
---|
| 4 | Immutable = require('immutable');
|
---|
| 5 |
|
---|
| 6 | global.require = require;
|
---|
| 7 |
|
---|
| 8 | new Benchmark.Suite()
|
---|
| 9 | .add('rootReducer iteration', {
|
---|
| 10 | fn: () => {
|
---|
| 11 | rootReducer(initialState, {
|
---|
| 12 | type: 'TEST'
|
---|
| 13 | });
|
---|
| 14 | },
|
---|
| 15 | setup: () => {
|
---|
| 16 | var combineReducers,
|
---|
| 17 | initialState,
|
---|
| 18 | rootReducer;
|
---|
| 19 |
|
---|
| 20 | initialState = Immutable.fromJS({
|
---|
| 21 | foo: {
|
---|
| 22 | test: 1
|
---|
| 23 | },
|
---|
| 24 | bar: {
|
---|
| 25 | test: 2
|
---|
| 26 | },
|
---|
| 27 | baz: {
|
---|
| 28 | test: 3
|
---|
| 29 | }
|
---|
| 30 | });
|
---|
| 31 |
|
---|
| 32 | combineReducers = require('./../dist/combineReducers');
|
---|
| 33 | // combineReducers = require('redux-immutablejs').combineReducers;
|
---|
| 34 |
|
---|
| 35 | rootReducer = combineReducers({
|
---|
| 36 | foo (state, action) {
|
---|
| 37 | return state;
|
---|
| 38 | },
|
---|
| 39 | bar (state) {
|
---|
| 40 | return state;
|
---|
| 41 | },
|
---|
| 42 | baz (state) {
|
---|
| 43 | return state;
|
---|
| 44 | }
|
---|
| 45 | });
|
---|
| 46 | }
|
---|
| 47 | })
|
---|
| 48 | .on('start', (event) => {
|
---|
| 49 | console.log('starting', event.target.name);
|
---|
| 50 | })
|
---|
| 51 | .on('cycle', (event) => {
|
---|
| 52 | console.log('target', String(event.target));
|
---|
| 53 | })
|
---|
| 54 | .on('error', (event) => {
|
---|
| 55 | console.log('error', String(event.target.error));
|
---|
| 56 | })
|
---|
| 57 | .run();
|
---|
Note:
See
TracBrowser
for help on using the repository browser.