Replies: 3 comments 6 replies
-
@dai-shi is it time to mark atomFamily as deprecated? |
Beta Was this translation helpful? Give feedback.
1 reply
-
Didn't we write something about discouraging areEqual? |
Beta Was this translation helpful? Give feedback.
5 replies
-
We should be able to do better than O(n^2). Let's just fix it. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I know there's already been a few discussions on removing the
atomFamily
function and making it into a recipe.But I think it should be discouraged or at least there should be some warning about the performance cost of
atomFamily
withareEqual
.Since right now it's doing a for loop over every atom in the atom family, for
n
atom reads, it will have a performance cost of O(n2).i.e. if you render a screen that has around 500 atoms, from an atom family that has 500 items, the
areEqual
function, at worst, will be called up to 250,000 times.I know it seems obvious, but it did caught me by surprise :p
Beta Was this translation helpful? Give feedback.
All reactions