Skip to content

Investigate optimizations for immutable invariant middleware #926

@markerikson

Description

@markerikson

The immutable invariant middleware is relatively slow, because it does deep checks on the whole state, and uses recursion.

I wonder if we'd be able to speed it up by:

  • Converting the recursion to some sort of a loop with a queue
  • Skipping certain items if they're already frozen

Granted, this only affects dev mode and not prod, but if we can speed it up a bit that would be a net win.

There are some other mutation detection options out there that involve proxies, like https://www.npmjs.com/package/mutation-sentinel and https://www.npmjs.com/package/will-mutate , but not sure if those approaches would work sufficiently for our use case.

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