jayphelps/core-decorators

Maybe add simple profiler?

Closed this issue · 3 comments

Usage

class UserPage extends Controller {
  @Timer()
  actionHome() {
    this.render('user/home', { user: this.global.user });
  }
}

Console:

Run UserPage.actionHome()
End UserPage.actionHome(): 3.765ms

LestaD/Decorators#Timer

I think there are a couple of issues with the way you create the timer:

  • Nested calls may interfere with each other since they share a label
  • console.time is not available in all browsers & js environments.

I'm also working on a version of this, will reply on this ticket shortly.

Here's the PR:

#38

#38 has been merged.