[plt-scheme] Profiling Contracts

From: Paulo J. Matos (pocmatos at gmail.com)
Date: Thu Jun 18 13:21:19 EDT 2009

On Thu, Jun 18, 2009 at 5:41 PM, Dave Herman<dherman at ccs.neu.edu> wrote:
> You can write your own wrapper:
> #lang scheme/base
> (require scheme/contract)
> (provide provide/contract*)
> (define-syntax provide/contract*
>  (syntax-rules ()
>    [(_ #:disable [name contract] ...)
>     (provide name ...)]
>    [(_ . rest)
>     (provide/contract . rest)]))

Hummm, Thanks. I indeed thought about something along these lines but
I would prefer something from 'certified' robby since there are cases
where provide/contract doesn't receive a [name contract] but instead
[struct name ...] for example which would render this not very useful
except for the most basic of contracts. I would like to be sure that
if I use something like this that it is general for all kinds of
provide/contract constructs and does exactly what it is supposed to do
when the contracts and enabled or disabled. I might try to generalize
if I get to that point. Either way, thank you very much for the
starting point!

> Dave
> Paulo J. Matos wrote:
>> On Thu, Jun 18, 2009 at 2:13 AM, Robby
>> Findler<robby at eecs.northwestern.edu> wrote:
>>> I would just run the profiler to find out what I find out.
>>> But you can always just disable the contracts (define provide/contract
>>> to be just provide, after stripping out the contracts) and then see
>>> that way.
>> That's still some rewriting...
>>  It would be nice if it were possible to send a flag to
>> provide/contract, such that if it is #t, contracts would not be
>> applied at all and provide/contract would behave as provide.
>>> Robby
>>> On Wed, Jun 17, 2009 at 5:30 PM, Paulo J. Matos<pocmatos at gmail.com>
>>> wrote:
>>>> Hi all,
>>>> Is there a way to profile the time taken checking contracts?
>>>> I have used contracts heavily in some parts of my model checker, many
>>>> times checking things that are more than simple type checks... and would
>>>> like to know if there is an easy way to know, 'hey for this exection, 5%
>>>> of the time was spent checking contracts'. If there is nothing
>>>> implemented to do this, are there any guidelines on how to find an
>>>> approximation of this value?
>>>> Cheers,
>>>> Paulo Matos
>>>> _________________________________________________
>>>>  For list-related administrative tasks:
>>>>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme

Paulo Jorge Matos - pocmatos at gmail.com

Posted on the users mailing list.