facebook / hermes

A JavaScript engine optimized for running React Native.
https://hermesengine.dev/
MIT License
9.85k stars 630 forks source link

Apollo Client is 4-10× slower with Hermes vs. JSC #1486

Open SimpleCreations opened 2 months ago

SimpleCreations commented 2 months ago

Bug Description

I've noticed a UI freeze when using Apollo Client's local resolvers for sizable amount of data (1000-2000 entities). It turned out that the query resolution runs 4-10 times slower with Hermes enabled.

React Native version: 0.75.1 OS: iOS

Steps To Reproduce

Here's a repo that mimics my real-world use case: https://github.com/SimpleCreations/hermes-apollo-client-perf-repro

Please let me know if there's any way I can help narrow down the issue.

Results on simulator

Hermes

Query execution time: 2524.45595908165
Query execution time: 2335.8469998836517
Query execution time: 2370.824375152588

JSC

Query execution time: 330.4612500667572
Query execution time: 245.70958304405212
Query execution time: 240.48808312416077

Results on a real device (iPhone 13 Pro)

Hermes

Query execution time: 2389.434458732605
Query execution time: 2270.058291912079
Query execution time: 2291.424584388733

JSC

Query execution time: 625.5239171981812
Query execution time: 538.3270416259766
Query execution time: 528.1435828208923
tmikov commented 2 months ago

Thanks we will look into this. Hermes is usually faster than JSC on iOS devices, so this slowdown must be caused by something specific.