https://github.com/paulmelnikow/function-profiler
Profile a function
https://github.com/paulmelnikow/function-profiler
function-profiler profile
Last synced: 9 months ago
JSON representation
Profile a function
- Host: GitHub
- URL: https://github.com/paulmelnikow/function-profiler
- Owner: paulmelnikow
- License: mit
- Created: 2017-02-24T17:05:10.000Z (almost 9 years ago)
- Default Branch: main
- Last Pushed: 2023-01-07T19:58:42.000Z (almost 3 years ago)
- Last Synced: 2025-02-13T20:40:24.251Z (11 months ago)
- Topics: function-profiler, profile
- Language: JavaScript
- Size: 243 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 17
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# function-profiler
[][npm]
[][npm]
[][build]
[][prettier]
[npm]: https://npmjs.com/function-profiler
[build]: https://circleci.com/gh/paulmelnikow/function-profiler/tree/main
[prettier]: https://prettier.io/
Profile a function. Print the elapsed time to the console.
Uses [`performance.now()`][performance.now] and currently works only in the
browser, though I'm open to making this isomorphic.
[performance.now]: https://developer.mozilla.org/en-US/docs/Web/API/Performance/now
## 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
```js
const profile = require('function-profiler')
const parsed = profile(yaml.safeLoad, 'Parsing yaml')(yamlStr)
```
```js
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
- Issue Tracker: https://github.com/paulmelnikow/function-profiler/issues
- Source Code: https://github.com/paulmelnikowfunction-profiler/
Pull requests welcome!
## Support
If you are having issues, please let me know.
## License
The project is licensed under the MIT license.