facebookexperimental/Recoil

[Performance] Short-circuit set recoil state if the value is unchanged

开放

#1,927 创建于 2022年7月30日

 (7 条评论) (1 个反应) (0 位负责人)JavaScript (1,151 个派生)batch import
help wantedperformance

仓库指标

星标
 (19,428 个星标)
PR 合并指标
 (30 天内没有已合并 PR)

描述

It seems that the current implementation of setting recoil state can be further improved when the value is the same as the current value. In this case, we don't have to go through all the enchilada and more importantly don't have to call setState in the end, which is not exactly cost free. I have observed major performance hit thanks to that. I have to cache the previous value myself and do the equality check before calling set recoil state when recoil has all the knowledge to that.

贡献者指南