js-performance

1.2.1 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i js-performance

Weekly Downloads

2

Version

1.2.1

License

MIT

Last publish

Collaborators

  • joezheng