Skip to content

Make existing benchmarks more realistic #9

Open
@markerikson

Description

@markerikson

The stockticker and twitter-lite benchmarks currently use an array for the root of the Redux state "tree", rather than an object with multiple slices. This is rather unrealistic. The tree-view example at least uses an object, although it's all just a single normalized lookup table rather than multiple slices too.

I'd really like it if these benchmarks were modified to separate the data into state slices. Using the stockticker benchmark as an example:

Right now, it's a single array of N entries, where N is defined in constants.js. I'd like to have a NUMBER_OF_SLICES constant that defines how many named state slices that should be split into. For example:

const NUMBER_OF_SLICES = 4;

const rootReducer = createRootReducer(NUMBER_OF_SLICES);
const exampleRootState = rootReducer(undefined, {type : "@@redux/init"});
console.log(exampleRootState);
// {slice1 : [], slice2 : [], slice3 : [], slice4 : [] }

With each of those slices having an equal number of items inside.

That way, the update patterns would be a bit more realistic - an update to state.slice2[123] would leave slices 1, 3, and 4 untouched.

This would require:

  • Altering the reducer logic to dynamically generate slices during reducer setup
  • Altering the root component(s) to do the same kind of work for each top-level slice (example: "render all stock ticker entries for state.slice, then for state.slice2", etc)
  • Passing down both a state slice name and an ID as props to the connected components so they know how to grab their own state if they're connected

Overall, I think this would give us some more realistic results.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions