Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/k1r0s/class-perf
utility to measure performance between class methods
https://github.com/k1r0s/class-perf
Last synced: 10 days ago
JSON representation
utility to measure performance between class methods
- Host: GitHub
- URL: https://github.com/k1r0s/class-perf
- Owner: k1r0s
- Created: 2018-03-17T10:09:07.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-03-17T10:17:51.000Z (over 6 years ago)
- Last Synced: 2024-10-13T02:13:53.136Z (24 days ago)
- Language: JavaScript
- Homepage: https://npm.im/class-perf
- Size: 1.95 KB
- Stars: 8
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
### usage
```javascript
import { startPerformance, endPerformance } from "class-perf";
class AnyClass {
@startPerformance()
someMethod() {// ...stuff
}@endPerformance()
anotherMethod() {// ...more stuff
}}
// when called logs
//
// PERF: Measure on AnyClass took ms```
### Custom milestones
By default class-perf decorators will retrieve class name by accessing constructor name, but if you provide a string as a parameter for decorators then message will be build using it instead of class name. For instance `@startPerformance("something")` and `@endPerformance("something")`.
> Note that strings should be the same to allow proper measurement
> TIP: `startPerformance` will be evaluated before decorated method will be executed and `endPerformance` will evaluate after decorated method has been executed