[racket] Using the profiler effectively?

From: Neil Van Dyke (neil at neilvandyke.org)
Date: Sun Sep 4 20:13:02 EDT 2011

What I did was read the section of the docs for "profile/render-text" 
carefully, while looking back at a real-world example I was interested in.

The example you gave, I think you cut off the juicy stuff.

Look for nodes with large percentages in Total or Self columns, and then 
follow the incoming and outgoing call graph edges with big percentages 
from those nodes, to follow the money.

I had to increase the frequency of the sampler.  Keep in mind that it 
will miss some significant things anyway.

I rigged up one Web app to append the profile report at the end of each 
HTML page.  Very convenient.

Also keep in mind that the profiler doesn't necessarily reflect blame 
for GC costs.  GC costs can be significant.

For a couple of programs, short-running and long-running, I had to rig 
up custom debug logging to figure out where we were getting hit with GC 
and then why.  (One finding: we took a big GC hit right after we did all 
of our "require"s, before we got to any app code, which makes sense, but 
it hurt us on short-lived, performance-sensitive processes.  I'd like to 
disable GC altogether for those.  Another finding: we took a hit every 
few requests or pages on a long-running process, and I'd like to 
schedule forced GC for when the server is only waiting.  Or if I have a 
multi-process architecture with separate GCs, the processes can GC in 
between requests being delegated to them, and not GC all at the same time.)

-- 
http://www.neilvandyke.org/


Posted on the users mailing list.