Update to My grunt-timer

New version of “grunt-timer”

I recently blogged about Grunt (the JavaScript task runner), and about an early version of my grunt-timer node package, for logging the elapsed execution time for each task as they are run by Grunt.

I’ve now released a new version of grunt-timer. The usage remains the same as before, so I wont repeat the old blog post on how to use it. Also, the README is up to date.

Open source

Open source is a great way to get software tested. Thanks to issues logged against the grunt-timer github repository, I’ve now made several improvements and fixes:

  1. Tasks (that aren’t really tasks) taking no time are no longer logged.

    • Let’s say you have a task “mytask” that has a “mytask:dist” configuration. “mytask:dist” is actually what should be timed (according to the “nameArgs” property). Therefore I have omitted tasks that take 2ms or less from the output. This was a serious issue with the previous version.
  2. A total elapsed time of all logged tasks is now also logged.

    • By adding a high intensity summary output at the end, it makes is more obvious that the the last entry isn’t itself a summary. It still has to appear after the “Done, without errors” unfortunately, due to the way the hooking for the task name change works. *Please let me know if you can see a way around this
  3. The initialisation period no longer contributes to logged times.

    • i.e. The time that is elapsed before your tasks are actually run (which is minimal) is not output, nor is it part of the summary. I decided that this initialisation time was irrelevant and only confusing the results.

Source code

The full source code is available here. I’m open to pull requests and suggestions as always.