I’m having a little trouble with profiling. I’m using DrRacket, and I went into Language | Choose Language… | Show Details, and selected “Debugging and profiling”. I then run some code and “View Profile”, and I see profiling output; however, it’s essentially useless since it’s not showing the important functions where all the work is being done.
All of the entries are just lines in my test suite, not the underlying functions that I need to profile.
I think the real answer is “use the profile
library”
I started there, but it was not at all clear how to proceed.
You write (profile (thing-that takes a long-time))
and then it prints out the profile
Thanks - I just found that buried in the docs :) I’d probably put that way at the top :)
you can also run raco profile file.rkt
which is probably even easier
Yes, I did raco profile perft.rkt
after I added the (require profile)
to my test suite. Still trying to see if the output is helpful…
I really can’t find a single function of mine in the output.
Ok, I think I had to use something that ran for a longer time, I’m seeing some decent info now.
This is really nice now - thanks @samth - I should have a really nice didactic chess engine pretty soon :)
Use -use-errortrace for more profile info
iirc
There’s also an option to sort the output, i find the default is not the best
Apropos didactic chess. I fell over this site the other day. Interesting concept. https://decodechess.com/