core icon indicating copy to clipboard operation
core copied to clipboard

Added Debug.logTime function for easier performance debugging

Open albertdahlin opened this issue 6 years ago • 4 comments

This lets you "tag" any function for easy performance debugging. More info in this discourse thread.

Wrap any function in your code: image

This will log the execution time in the console: image

It is also visible in the performance timeline: image

albertdahlin avatar Dec 01 '18 10:12 albertdahlin

I was thinking about renaming this function to Debug.benchmark instead, is that better?

albertdahlin avatar Jul 17 '19 06:07 albertdahlin

Considering that this addition will take a long time to be included in an official package; how do you build this core package and include it in your environment?

Tails avatar Feb 18 '22 20:02 Tails

The way I use this locally is

  • Replace the Debug.elm module somewhere in ~/.elm/packages or wherever they are located on your system (I use Linux)
  • Remove the *.dat files in the core module (found in the parent dir to where Debug.elm is located)
  • Remove elm-stuff in my project.

Then you should be able to use Debug.logTime in your project. Probably there is a better way to do this but it works on my computer ;-)

albertdahlin avatar Feb 19 '22 15:02 albertdahlin

It compiles! That's excellent. Lifesaver!

So someone should at some point be making an "illegal" package manager for Elm that applies and unapplies core patches such as your excellent one.

Tails avatar Feb 19 '22 16:02 Tails