javascriptreact-nativejavascript-enginereact-native-hermes

Measuring the Performance with the Hermes Engine


I am trying to profiling in React Native and using hermes engine. I want measure the time in between a function call. In Js We can use console.time or performace.now but when I am using those fucntion with hermes engine I am getting "Undefined is not a function" Error.

When I am running the same code with Chrome debugger it is working fine.

Can anyone suggest how i can implement the below code with the hermes engine.

const checkTime = () => {
   console.time('time_NoOp');
   doNothing();
   console.timeEnd('time_NoOp');
   
};   

.

enter image description here


Solution

  • Update:

    I am able to solve the problem by using the below code

    const PerformanceTime=() => {
       const t0 = performance.now();
       doNothing();
       const t1 = performance.now();
       console.log(t1 - t0);
    }