Skip to main content
Version: Next

getFasterFunc

This method takes any number of arbitrary functions as input and returns the fastest one in terms of execution time

Params

getFasterFunc(inputFunction1,inputFunction2,inputFunction3,...);
  • inputFunctionN... → The functions we want to compare their execution time with each other and return the fastest one

Returns

[Function: testFunction1]
  • Function → The fastest function in terms of execution time among input functions

Usage

const testFunction1 = () => {
let a = 2345345436;
let b = 45364536457;
let c = a * b;
};

const testFunction2 = () => {
let a = 2345345436343343434n;
let b = 4536453645343474545n;
let c = a * b;
};

getFasterFunc(testFunction1,testFunction2)//[Function: testFunction1]