Skip to content

Why finalise step is slow in immer ? Why is it more performant to setAutoFreeze to true? #1154

Closed
@vsvamsi1

Description

@vsvamsi1

🙋‍♂ Question

I have noticed the finalise step in a "produce" to be quiet slow and i was looking out to see if there are any alternative libraries to immer which is faster. I have come across a library called mutative, in that they have stated the following about immer

But its performance issue causes a runtime performance overhead. Immer must have auto-freeze enabled by default(Performance will be worse if auto-freeze is disabled), such immutable state with Immer is not common. In scenarios such as cross-processing, remote data transfer, etc., these immutable data must be constantly frozen.

I noticed the same, the performance of immer improving after setting autoFreeze is true. I was wondering why does this happen, isn't there a cost associated to freezing? What affects the finalise step of a draft in a produce?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions