www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Does LDC support profiling at all?

reply Chris Katko <ckatko gmail.com> writes:
DMD can use -profile and -profile=gc. But I tried for HOURS to 
find the equivalent for LDC and came up with only profile-guided 
optimization--which I don't believe I want. Yet, if we can get 
PGO... where's the PROFILE itself it's using to make those 
decisions! :)

Thanks.
Dec 22 2017
next sibling parent Nathan S. <no.public.email example.com> writes:
On Friday, 22 December 2017 at 09:52:26 UTC, Chris Katko wrote:
 DMD can use -profile and -profile=gc. But I tried for HOURS to 
 find the equivalent for LDC and came up with only 
 profile-guided optimization--which I don't believe I want. Yet, 
 if we can get PGO... where's the PROFILE itself it's using to 
 make those decisions! :)

 Thanks.
Is -fprofile-instr-generate=<place to write profile> what you're looking for?
Dec 22 2017
prev sibling next sibling parent reply Johan Engelen <j j.nl> writes:
On Friday, 22 December 2017 at 09:52:26 UTC, Chris Katko wrote:
 DMD can use -profile and -profile=gc. But I tried for HOURS to 
 find the equivalent for LDC and came up with only 
 profile-guided optimization--which I don't believe I want. Yet, 
 if we can get PGO... where's the PROFILE itself it's using to 
 make those decisions! :)
Fine grained PGO profiling: -fprofile-instr-generate http://johanengelen.github.io/ldc/2016/07/15/Profile-Guided-Optimization-with-LDC.html Function entry/exit profiling: -finstrument-functions https://github.com/ldc-developers/ldc/issues/1839 https://www.youtube.com/watch?v=LNav5qvyK7I I suspect it is not too much effort to add DMD's -profile and -profile=gc to LDC, but noone has done it yet. Another thing that is relatively easy to add to LDC: https://llvm.org/docs/XRay.html -Johan
Dec 23 2017
next sibling parent David Nadlinger <code klickverbot.at> writes:
On Saturday, 23 December 2017 at 12:23:33 UTC, Johan Engelen 
wrote:
 Fine grained PGO profiling:
 -fprofile-instr-generate
 http://johanengelen.github.io/ldc/2016/07/15/Profile-Guided-Optimization-with-LDC.html

 Function entry/exit profiling:
 -finstrument-functions
 https://github.com/ldc-developers/ldc/issues/1839
 https://www.youtube.com/watch?v=LNav5qvyK7I

 I suspect it is not too much effort to add DMD's -profile and 
 -profile=gc to LDC, but noone has done it yet.

 Another thing that is relatively easy to add to LDC: 
 https://llvm.org/docs/XRay.html
Apart from profiling based on compiler instrumentation, don't forget that LDC uses the standard object file formats/runtime libraries for the various platforms, so all the usual profiling tools like perf, VTune, Valgrind, etc. work just fine. I would usually start with one of the latter for general-purpose optimization work. — David
Dec 23 2017
prev sibling parent reply Chris Katko <CKATKO GMAIL.COM> writes:
On Saturday, 23 December 2017 at 12:23:33 UTC, Johan Engelen 
wrote:
 On Friday, 22 December 2017 at 09:52:26 UTC, Chris Katko wrote:
 DMD can use -profile and -profile=gc. But I tried for HOURS to 
 find the equivalent for LDC and came up with only 
 profile-guided optimization--which I don't believe I want. 
 Yet, if we can get PGO... where's the PROFILE itself it's 
 using to make those decisions! :)
Fine grained PGO profiling: -fprofile-instr-generate http://johanengelen.github.io/ldc/2016/07/15/Profile-Guided-Optimization-with-LDC.html Function entry/exit profiling: -finstrument-functions https://github.com/ldc-developers/ldc/issues/1839 https://www.youtube.com/watch?v=LNav5qvyK7I I suspect it is not too much effort to add DMD's -profile and -profile=gc to LDC, but noone has done it yet. Another thing that is relatively easy to add to LDC: https://llvm.org/docs/XRay.html -Johan
Wow, thanks guys! I didn't realize I'd get so much information so quickly here on the forums. The documentation online for LDC is very sparse and confusing. After spending plenty of attempts, I went out of my way to install DMD just to get profiling because I couldn't figure it out with LDC. It would probably be really helpful to get a clear Wiki guide for this information LDC. I'll write it myself if necessary once I try your recommendations and test them out.
Dec 23 2017
parent Johan Engelen <j j.nl> writes:
On Sunday, 24 December 2017 at 02:48:32 UTC, Chris Katko wrote:
 It would probably be really helpful to get a clear Wiki guide 
 for this information LDC. I'll write it myself if necessary 
 once I try your recommendations and test them out.
This would help us out a lot, thanks. -Johan
Dec 24 2017
prev sibling parent Prasun Anand <prasunanand.bitsp gmail.com> writes:
On Friday, 22 December 2017 at 09:52:26 UTC, Chris Katko wrote:
 DMD can use -profile and -profile=gc. But I tried for HOURS to 
 find the equivalent for LDC and came up with only 
 profile-guided optimization--which I don't believe I want. Yet, 
 if we can get PGO... where's the PROFILE itself it's using to 
 make those decisions! :)

 Thanks.
Hi Chris, I think you might be looking for google perftools. See: 1. https://github.com/prasunanand/gperftools_d/ 2. https://github.com/gperftools/gperftools I have been using gperftools_d a lot to profile my code and optimize.It generates really cool [graphs](https://github.com/prasunanand/gperftools_d/blob/master/examples/profile.pdf). If you need PGO, you can look here for reference: https://github.com/prasunanand/faster_lmm_d/blob/master/Makefile#L122 Let me know if this helps or you face any issues using gperftools_d. Regards, Prasun
Dec 26 2017