Skip to content

Idea: always freeze + freeze export #687

@mweststrate

Description

@mweststrate

🚀 Feature Proposal

Currently autoFreeze is disabled by default in production builds, with the assumption that that is faster. However, since the deep pruning for drafts introduced in Immer 7, that is no longer the case; frozen data allows for an early bail out, where non frozen data doesnt. So although initial storage is slower with autofreeze, subsequent updates are faster.

By enabling auttoFreeze in all environments by default we fix a few problems:

  • no difference between prod and non prod
  • usually faster, but always more predictable performance

As optimisation tip it should be made clear that shallowly pre-freezing data about to be stored can bail out of expensive deep freezing without loosing the benefits of the non-deep pruning. Maybe even export a specific preFreeze method for this reason, or reuse the existing freeze export.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions