badkins
2021-2-5 03:41:58

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.


badkins
2021-2-5 03:43:08

All of the entries are just lines in my test suite, not the underlying functions that I need to profile.


samth
2021-2-5 03:46:04

I think the real answer is “use the profile library”


badkins
2021-2-5 03:46:24

I started there, but it was not at all clear how to proceed.


samth
2021-2-5 03:47:01

You write (profile (thing-that takes a long-time)) and then it prints out the profile


badkins
2021-2-5 03:50:29

Thanks - I just found that buried in the docs :) I’d probably put that way at the top :)


samth
2021-2-5 03:51:31

you can also run raco profile file.rkt


samth
2021-2-5 03:51:38

which is probably even easier


badkins
2021-2-5 03:52:15

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…


badkins
2021-2-5 03:58:34

I really can’t find a single function of mine in the output.


badkins
2021-2-5 04:00:24

Ok, I think I had to use something that ran for a longer time, I’m seeing some decent info now.


badkins
2021-2-5 04:16:55

This is really nice now - thanks @samth - I should have a really nice didactic chess engine pretty soon :)


laurent.orseau
2021-2-5 07:55:17

Use -use-errortrace for more profile info


laurent.orseau
2021-2-5 07:55:30

iirc


laurent.orseau
2021-2-5 07:56:47

There’s also an option to sort the output, i find the default is not the best


soegaard2
2021-2-5 07:59:13

Apropos didactic chess. I fell over this site the other day. Interesting concept. https://decodechess.com/