facebook / facebook/hermes

Date 800x slower than JSC

Open
#930 68 comments 35 reactions 0 assignees View on GitHub
enhancement
Dominant language
JavaScript
Stars
11.3k
Forks
859
Avg merge
1h 30m
Merged PRs (30d)
3

Description

## Bug Description

Date so slow that it can be freeze app. Impossible to use third party date library(much worse perf, 1800x).
I found that **local date** is a problem. UTC date still slow but not 800x, just 8x slower than JSC which can be ignored.

The **code** outputs:
JSC: 0.2605330003425479
Hermes: 166.44708999991417
Hermes UTC: 1.6460870001465082

- [x] I have run `gradle clean` and confirmed this bug does not occur with JSC

Hermes version: Bundled version with RN 0.71.3
React Native version (if any): 0.71.3
OS version (if any): iPhone 14 (simulator)
Platform (most likely one of arm64-v8a, armeabi-v7a, x86, x86_64):

## Steps To Reproduce

1. Create initial app with latest RN version.
2. Add somewhere the code that down below. Look console to see the numbers.

code example:

```js
var a = performance.now();
Array(1000)
.fill(0)
.map(() => {
new Date(new Date().setMonth(1));
// fast utc version
// new Date(new Date().setUTCMonth(1));
});
var b = performance.now();

console.log(b - a);
```

## The Expected Behavior
Fast Date operations.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.