Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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