Skip to content

Seeing 40%+ slowness in simple useLiveQuery vs redux selectors when rendering many items #445

@skidrowe

Description

@skidrowe

We have a React app that uses redux/re-reselect to render many items on the screen at a time. Switching the code to use tanstack db/useLiveQuery causes 40% or more speed reduction. A simple runnable example is attached...

return useLiveQuery(q =>
    q
      .from({ item: orderCollection })
      .where(({ item }) => eq(item.gridId, gridId))
      .where(({ item }) => eq(item.rowId, rowId))
      .where(({ item }) => eq(item.side, side))
  );

vs

useSelector((state:IStore) => getOrderBySideAndRowId(state, props));

test.zip

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