function-profiler
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

function-profiler

version license build code style

Profile a function. Print the elapsed time to the console.

Uses performance.now() and currently works only in the browser, though I'm open to making this isomorphic.

Motivation

I created this because I wanted to do something simple. The other packages I found were either much more complicated, or only worked in Node.

Usage

const profile = require('function-profiler')
 
const parsed = profile(yaml.safeLoad, 'Parsing yaml')(yamlStr)
const profile = require('function-profiler')
 
class Parser {
  parse(yamlStr) {
    return yaml.safeLoad(yamlStr)
  }
}
 
Parser.prototype.parse = profile(Parser.prototype.parse, 'Parsing YAML')

Installation

npm install --save function-profiler

Contribute

Pull requests welcome!

Support

If you are having issues, please let me know.

License

The project is licensed under the MIT license.

Readme

Keywords

Package Sidebar

Install

npm i function-profiler

Weekly Downloads

1

Version

1.1.0

License

MIT

Unpacked Size

4.67 kB

Total Files

6

Last publish

Collaborators

  • paulmelnikow