Computer scienceBackendNode.jsCore ConceptsInternal modulesPerformance measurement

Intro to performance hooks

Operation duration

Report a typo

Rearrange the lines below to measure the performance of myOperation function.

Reorder lines using drag or arrows. Adjust indentation with left buttons
                import { performance } from 'perf_hooks';
              
                myOperation();
              
                const entries = performance.getEntriesByName('My Operation');
              
                performance.mark('end');
              
                console.log(entries[0].duration);
              
                performance.mark('start');
              
                performance.measure('My Operation', 'start', 'end');
              

Create a free account to access the full topic