facebookexperimental/Recoil

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

Open

Aperta il 30 lug 2022

Vedi su GitHub
 (7 commenti) (1 reazione) (0 assegnatari)JavaScript (19.428 star) (1151 fork)batch import
help wantedperformance

Descrizione

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.

Guida contributor