Skip to content

Performance drop using cloneDeep of lodash #471

@karol-bisztyga

Description

@karol-bisztyga

Bug Description

There is a significant performance drop using cloneDeep of lodash, it takes approximately 25-45 times longer to execute when running with Hermes on android.

  • I have run gradle clean and confirmed this bug does not occur with JSC

Hermes version: hermes-engine: 0.5.1
React Native version (if any): 0.63.4
OS version (if any): Android 10 x86 Pixel 3 simulator
Platform (most likely one of arm64-v8a, armeabi-v7a, x86, x86_64): x86_64

Minimal reproducing repository

https://github.com/karol-bisztyga/hermes-repro
There are 2 commits:

  • init - use it to test without Hermes
  • with hermes - use it to test with Hermes

For reproducing this I used a randomly generated JSON file, which is here, it is a 1MB file(just FYI, you don't have to worry about this, it's hardcoded in the repro already).

Tests results

Running sample code from the repro provided I got following results(that stand for times of execution of doing JSON.parse, clondeDeep and both combined):

- no hermes:
{ parse: [ 32, 11, 16, 14, 17, 15, 14, 17, 14, 12 ],
      clone: [ 218, 209, 114, 122, 117, 114, 117, 123, 111, 118 ],
      parseClone: [ 235, 137, 141, 132, 125, 142, 131, 131, 141, 136 ] }
- with hermes:
{ parse: [ 24, 18, 22, 17, 17, 13, 18, 13, 18, 12 ],
      clone: [ 5667, 5318, 5500, 5395, 5576, 5760, 5553, 5349, 5669, 5455 ],
      parseClone: [ 5405, 5388, 5787, 5452, 5426, 5360, 5381, 5364, 5455, 5390 ] }

The Expected Behavior

Similar time of execution of clondeDeep with and without Hermes

Note

I didn't know how to categorize it so I went for the Bug, sorry if that's not the best way, I couldn't find a category for the performance drop.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions