Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Debug.logTime function for easier performance debugging #1007

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

albertdahlin
Copy link

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
Copy link
Author

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

@Tails
Copy link

Tails commented Feb 18, 2022

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?

@albertdahlin
Copy link
Author

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 ;-)

@Tails
Copy link

Tails commented Feb 19, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants