Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const runMultiplePrimitiveSuite = () => {
const fibonacciSuite = new Benchmark.Suite( 'Multiple parameters (Primitive)' );
const fibonacciNumber = 35;
const isComplete = false;
const mMemoizee = memoizee( fibonacciMultiplePrimitive );
const mFastMemoize = fastMemoize( fibonacciMultiplePrimitive );
const mMemoizejs = memoizejs( fibonacciMultiplePrimitive );
const mMemoizerific = memoizerific( Infinity )( fibonacciMultiplePrimitive );
const mLruMemoize = lruMemoize( Infinity )( fibonacciMultiplePrimitive );
const mMoize = moize( fibonacciMultiplePrimitive );
const mMoizeSerialize = moize.serialize( fibonacciMultiplePrimitive );
const mMemize = memize( fibonacciMultiplePrimitive );
return new Promise( ( resolve ) => {
fibonacciSuite
.add( 'memoizee', () => {
mMemoizee( fibonacciNumber, isComplete );
} )
.add( 'fast-memoize', () => {
mFastMemoize( fibonacciNumber, isComplete );
} )
.add( 'memoizejs', () => {
mMemoizejs( fibonacciNumber, isComplete );
} )
.add( 'memoizerific', () => {
mMemoizerific( fibonacciNumber, isComplete );
} )
const runMultipleObjectSuite = () => {
const fibonacciSuite = new Benchmark.Suite( 'Multiple parameters (Object)' );
const fibonacciNumber = 35;
const isComplete = {
isComplete: false,
};
const mMemoizee = memoizee( fibonacciMultipleObject );
const mFastMemoize = fastMemoize( fibonacciMultipleObject );
const mMemoizejs = memoizejs( fibonacciMultipleObject );
const mMemoizerific = memoizerific( Infinity )( fibonacciMultipleObject );
const mLruMemoize = lruMemoize( Infinity )( fibonacciMultipleObject );
const mMoize = moize( fibonacciMultipleObject );
const mMoizeSerialize = moize.serialize( fibonacciMultipleObject );
const mMemize = memize( fibonacciMultipleObject );
return new Promise( ( resolve ) => {
fibonacciSuite
.add( 'memoizee', () => {
mMemoizee( fibonacciNumber, isComplete );
} )
.add( 'fast-memoize', () => {
mFastMemoize( fibonacciNumber, isComplete );
} )
.add( 'memoizejs', () => {
mMemoizejs( fibonacciNumber, isComplete );
} )
.add( 'memoizerific', () => {
mMemoizerific( fibonacciNumber, isComplete );
} )
const runSingleParameterSuite = () => {
const fibonacciSuite = new Benchmark.Suite( 'Single parameter' );
const fibonacciNumber = 35;
const mUnderscore = underscore( fibonacci );
const mLodash = lodash( fibonacci );
const mRamda = ramda( fibonacci );
const mMemoizee = memoizee( fibonacci );
const mFastMemoize = fastMemoize( fibonacci );
const mMemoizejs = memoizejs( fibonacci );
const mMemoizerific = memoizerific( Infinity )( fibonacci );
const mLruMemoize = lruMemoize( Infinity )( fibonacci );
const mMoize = moize( fibonacci );
const mMoizeSerialize = moize.serialize( fibonacci );
const mMemize = memize( fibonacci );
return new Promise( ( resolve ) => {
fibonacciSuite
.add( 'underscore', () => {
mUnderscore( fibonacciNumber );
} )
.add( 'lodash', () => {
mLodash( fibonacciNumber );
} )
.add( 'memoizee', () => {
mMemoizee( fibonacciNumber );
} )
.add( 'ramda', () => {
mRamda( fibonacciNumber );
} )