findingNemo2
findingNemo2
6
1.2K
aneagoie
aneagoie
This repl has no description
More repls
14comments
to comment
VaidyanathanRad
VaidyanathanRad6 months ago

I wrote a similar one in Python. Please find the below for reference

import time

nemo = ["NEMO"]large = ['NEMO'] * 10

def findNemo(nemo): start = time.time() for x in nemo: if x == "NEMO": print("Found nemo") done = time.time() elapsed = done - start print('Took ' + str(elapsed) + ' milliseconds')

findNemo(large)

MoksheshVora
MoksheshVora7 months ago

i cant find this code in python language please help me

sagarshelby
sagarshelby8 months ago

That performance error was making me go mad!!

THC1111
THC11119 months ago

thanks @MeJaymin

11 months ago

To resolve the error - ReferenceError: performance is not defined at findNemo2, declare this at the beginning of your code - const { performance } = require('perf_hooks');

More information can be found in this StackOverflow link: https://stackoverflow.com/questions/46436943/referenceerror-performance-is-not-defined-when-using-performance-now

MeJaymin
MeJaymin11 months ago

Thosewhoever are getting error please use:

const performance = require('perf_hooks').performance;

ake1996
ake199611 months ago

hey @aneagoie its showing error as:

ReferenceError: performance is not defined at findNemo2 (/home/runner/keocn3XqyGT/index.js:8:12) at /home/runner/keocn3XqyGT/index.js:18:1 at Script.runInContext (vm.js:130:18) at Object. (/run_dir/interp.js:209:20) at Module._compile (internal/modules/cjs/loader.js:1137:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10) at Module.load (internal/modules/cjs/loader.js:985:32) at Function.Module._load (internal/modules/cjs/loader.js:878:14) at Function.executeUserEntryPoint as runMain at internal/main/run_main_module.js:17:47

RahulBorah
RahulBorah11 months ago

Include this statement to resolve the issue.

const {performance} = require('perf_hooks');

RahulBorah
RahulBorah11 months ago

If you run it throws "Reference Error: performance is not defined"