Why does ApolloClient InMemoryCache entityStore getFieldValue need to use maybeDeepFreeze?

I’m currently using Apollo Client v3.8.6 in dev mode. I’ve noticed that when I query a large amount of data (around 6000 objects), it takes approximately 300ms on an M2 MacBook and 800ms on an iPhone 11. After a thorough investigation, I found that a significant portion of the time is spent on the InMemoryCache entityStore’s getFieldValue, primarily due to the maybeDeepFreeze function. The deepFreeze function consumes a lot of time. I would like to understand why dev mode requires deepFreeze in getFieldValue.

I expect that in dev mode, the query speed should be as fast as in production mode.

Hi @benny0642, I believe I already answered this question with this exact wording over in StackOverflow: reactjs - Why does ApolloClient InMemoryCache entityStore getFieldValue need to use maybeDeepFreeze? - Stack Overflow

Let’s keep this to one platform, okay? You already have an answer from an Apollo Client maintainer, I think it can’t get a lot more insightful than that :wink:

Sure, thanks for the answer!