npm.io
1.2.1 • Published 9 years ago

js-performance

Licence
MIT
Version
1.2.1
Deps
0
Vulns
0
Weekly
0

js-performance

A simple javascript utility to measure performance

Reason

Using console.time and console.timeEnd is tedious and may introduce extra time by invoking console.

Usage

  • time to mark the start point
  • timeEnd to mark the end point
  • log to log all mark message together
  • block to block js thread
import {time, timeEnd, log, block} from 'js-performance'

time('test')
block(5000)
timeEnd('test')

log() // test: 5000ms
  • measureCRP to measure the CRP time including interactive, domContentLoaded and complete
import {measureCRP} from 'js-performance'

measureCRP() // log your CRP time

Keywords