[racket-dev] [racket] Profiling mostly macro-generated definitions?

From: Antonio Menezes Leitao (antonio.menezes.leitao at ist.utl.pt)
Date: Thu Aug 30 16:48:44 EDT 2012

On Wed, Aug 29, 2012 at 1:14 PM, Robby Findler
<robby at eecs.northwestern.edu> wrote:
> On Wed, Aug 29, 2012 at 5:26 AM, Antonio Leitao <aml at gia.ist.utl.pt> wrote:
>> On Tue, Aug 28, 2012 at 7:17 PM, Robby Findler
>> <robby at eecs.northwestern.edu> wrote:
>>> Well, here's an example of it working. I don't know what to suggest
>>> but to ask if you could make a small program that illustrates it not
>>> working and maybe we can go from there to understand why you're seeing
>>> what you're seeing.
>>>
>>> #lang racket
>>> (require profile)
>>>
>>> (define h (make-hash))
>>> (profile
>>>  (let loop ([n 1000000])
>>>    (unless (zero? n)
>>>      (hash-set! h n #t)
>>>      (hash-ref h n)
>>>      (loop (- n 1)))))
>>
>> This exact program, in DrRacket 5.3 (Windows 64 bits)
>> only shows
>>
>> Welcome to DrRacket, version 5.3 [3m].
>> Language: racket; memory limit: 1024 MB.
>> Profiling results
>> -----------------
>>   Total cpu time observed: 904ms (out of 905ms)
>>   Number of samples taken: 11 (once every 82ms)
>>
>> ====================================
>>                         Caller
>> Idx  Total    Self    Name+srcLocal%
>>      ms(pct)  ms(pct)   Callee
>> ====================================
>>>
>>
>> Increasing the loop to 10000000 iterations shows:
>>
>> Welcome to DrRacket, version 5.3 [3m].
>> Language: racket; memory limit: 1024 MB.
>> Profiling results
>> -----------------
>>   Total cpu time observed: 8464ms (out of 8549ms)
>>   Number of samples taken: 116 (once every 73ms)
>>
>> ====================================
>>                         Caller
>> Idx  Total    Self    Name+srcLocal%
>>      ms(pct)  ms(pct)   Callee
>> ====================================
>>>
>>
>> Is this happening because I'm running the code in
>> DrRacket?
>
> (I've re-added dev; hope that's okay.)
>
> No, that shouldn't be the cause.
>
> I'm forgetting now when this is triggered, but I recall that on some
> platforms, or with some ways the installation is configured, stack
> traces can be disabled (which would render the profiler useless, as
> that's how it figures out what is going on). Probably this is what
> you're seeing.
>
> FWIW, the version of Windows I use is Windows 7 and I see good output
> using version 5.3, the latest nightly build, and a version I just
> build myself (I checked the nightly and the release just to see if
> there were different configuration options used.)
>
> I believe I'm using the 32 bit build in all those cases, tho. Are you
> using the 64 bit one?

Yes.

Posted on the dev mailing list.