[racket-dev] [racket-bug] all/14404: "profile" would be more useful if it returned the result(s) of evaluating its body

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Thu Mar 27 15:20:01 EDT 2014

It seems unlikely that anyone does, but could you look at the code on the
pkg server to check?

Robby


On Thu, Mar 27, 2014 at 1:42 PM, Vincent St-Amour <stamourv at ccs.neu.edu>wrote:

> [ccing dev]
>
> I agree. That would also make adding profiling less intrusive than it is
> now. Consistency with `time' would also be nice. FWIW, `contract-profile'
> behaves like `time'.
>
> Currently `profile' and `profile-thunk' return whatever the profile
> renderer returns. Most renderers print their report and return void.
> But, as the documentation mentions, `values' can be used as a renderer
> in which case `profile' returns the pre-rendering analyzed profile
> data. Returning the result of the profiled expression would break that
> behavior.
>
> On the other hand, it's already possible to get the analyzed data by
> invoking the sampler and the analyzer directly. Changing the behavior of
> `profile' wouldn't remove that functionality, just make it less
> convenient.
>
> Does anyone rely on that behavior from `profile' and `profile-thunk'?
> If not, I think we should change it.
>
> Vincent
>
>
>
> At Sat, 15 Mar 2014 23:12:11 -0400,
> eric.hanchrow at gmail.com wrote:
> >
> > A new problem report is waiting at
> >   http://bugs.racket-lang.org/query/?cmd=view&pr=14404
> >
> > Reported by Eric Hanchrow for release: 6.0.0.1--2013-12-13(1f1550a/a)
> >
> > *** Description:
> > I recently tried to use profile, and didn't closely read its
> documentation.  I naively assumed that it would work similarly to "time" --
> namely that I could simply wrap (profile ...) around my code, and my code
> would continue to run, but would also emit profiling information.  But of
> course profile returns void, so I had to tediously capture my thunk's value
> myself, and then arrange to have that value passed "outside" of the profile
> call.  Anyway ... I'd like the below snippet to print 9 not just once (from
> the call to "time"), but twice.
> >
> > *** How to repeat:
> > #lang racket
> >
> > (require profile)
> >
> > (displayln (profile (+ 2 3 4)))
> > (displayln (time (+ 2 3 4)))
> >
> > *** Environment:
> > macosx "Darwin Eric-Hanchrows-MacBook-Pro.local 13.1.0 Darwin Kernel
> Version 13.1.0: Thu Jan 16 19:40:37 PST 2014;
> root:xnu-2422.90.20~2/RELEASE_X86_64 x86_64" (x86_64-macosx/3m)
> (get-display-depth) = 32
> > Human Language: english
> > (current-memory-use) 287758760
> > Links: (links) = (); (links #:user? #f) = ("contract-profile" "syntax"
> "mysterx" "sgl" "datalog" "shell-completion" "algol60" "icons" "ds-store"
> "slatex" "realm" "games" "make" "trace" "plai" "eopl" "lazy" "preprocessor"
> "profile" "racklog" "mzcom" "schemeunit" "unstable" "frtime" "mrlib"
> "swindle"); (links #:root? #t) =
> (#<path:/Users/erichanchrow/Library/Racket/snapshot/pkgs/throw>
> #<path:/Users/erichanchrow/Library/Racket/snapshot/pkgs/zeromq>
> #<path:/Users/erichanchrow/Library/Racket/snapshot/pkgs/zmq>); (links
> #:user? #f #:root? #t) = (#<path:/Applications/Racket
> v6.0.0.1/share/pkgs/racket-lib> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/main-distribution> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/at-exp-lib> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/compatibility> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/compiler> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/data> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/db> #<path:/Applications/Racket
>   !
> >  v6.0.0.1/share/pkgs/deinprogramm> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/draw> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/draw-doc> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/draw-lib> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/drracket> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/errortrace> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/future-visualizer> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/future-visualizer-typed> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/gui> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/htdp> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/html> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/images> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/macro-debugger> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/macro-debugger-text-lib> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/math> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/mzscheme> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/net> #<path
>  :!
> >  /Applications/Racket v6.0.0.1/share/pkgs/parser-tools> #<path:!
> >  /Applications/Racket v6.0.0.1/share/pkgs/pconvert-lib>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/pict>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/picturing-programs>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/planet>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/plot>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/profile>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/r5rs>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/r6rs>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/racket-doc>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/distributed-places>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/racket-index>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/rackunit>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/readline>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/redex>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/sandbox-lib>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/scribble>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/seriali
>  z!
> >  e-cstruct-lib> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/slideshow> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/snip> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/srfi> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/string-constants> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/syntax-color> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/typed-racket> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/typed-racket-more> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/unstable> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/unstable-contract-lib> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/unstable-latent-contract-lib>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/unstable-list-lib>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/unstable-options-lib>
> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/unstable-parameter-group-lib>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/unstable-2d>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/web-server> #<pat
>  h!
> >  :/Applications/Racket v6.0.0.1/share/pkgs/wxme> #<path:/Applications/Ra!
> >  cket v6.0.0.1/share/pkgs/xrepl> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/base> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/compatibility-lib> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/drracket-plugin-lib> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/errortrace-lib> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/gui-lib> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/parser-tools-lib> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/string-constants-lib> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/rackunit-lib> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/scribble-doc> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/scribble-lib> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/compatibility-doc> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/math-lib> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/compiler-lib> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/data-lib> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/data-doc> #<path:/Application
>  s!
> >  /Racket v6.0.0.1/share/pkgs/db-lib> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/db-doc> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/scheme-lib> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/srfi-lib> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/wxme-lib> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/gui-doc> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/pict-doc> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/pict-lib> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/draw-x86_64-macosx> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/planet-lib> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/snip-lib> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/typed-racket-lib> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/html-lib> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/images-lib> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/net-lib> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/srfi-doc> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/gui-pkg-manag
>  e!
> >  r-lib> #<path:/Applications/Racket v6.0.0.1/share/pkgs/mzscheme-doc> #<!
> >  path:/Applications/Racket v6.0.0.1/share/pkgs/net-doc>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/planet-doc>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/string-constants-doc>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/errortrace-doc>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/profile-doc>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/r5rs-doc>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/srfi-lite-lib>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/htdp-lib>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/htdp-doc>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/html-doc>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/images-gui-lib>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/images-doc>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/eli-tester>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/cext-lib>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/math-doc>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/mzscheme-lib>
> #<path:/Applications
>  /!
> >  Racket v6.0.0.1/share/pkgs/parser-tools-doc>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/web-server-lib>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/web-server-doc>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/plot-lib>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/plot-gui-lib>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/plot-doc>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/r5rs-lib>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/r6rs-lib>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/r6rs-doc>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/rackunit-doc>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/typed-racket-doc>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/slideshow-doc>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/distributed-places-lib>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/distributed-places-doc>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/rackunit-gui>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/rackunit-plugin-l
>  i!
> >  b> #<path:/Applications/Racket v6.0.0.1/share/pkgs/readline-lib> #<path!
> >  :/Applications/Racket v6.0.0.1/share/pkgs/readline-doc>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/redex-doc>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/redex-examples>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/redex-lib>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/redex-gui-lib>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/slideshow-lib>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/slideshow-exe>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/slideshow-plugin>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/syntax-color-lib>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/syntax-color-doc>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/unstable-flonum-lib>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/xrepl-lib>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/xrepl-doc>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/gui-x86_64-macosx>
> #<path:/Applications/Racket v6.0.0.1/share/pkgs/scribble-text-lib>
> #<path:/Applications/Racket v6.0.0.1/shar
>  e!
> >  /pkgs/math-x86_64-macosx> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/unstable-macro-testing-lib> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/unstable-debug-lib> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/unstable-pretty-lib> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/plot-compat> #<path:/Applications/Racket
> v6.0.0.1/share/pkgs/redex-pict-lib>)
> > raco pkg (show):
> > Installation-wide:
> >  Package              Checksum                                    Source
> >  main-distribution    009c289657b86ab25f320828841fa61a5425a257
>  (catalog main-distribution)
> >  racket-lib           15de3807106727eeb46c7df35153b8ab29bd6f1f
>  (catalog racket-lib)
> >  [175 auto-installed packages not shown]
> > User-specific for installation "snapshot":
> >  Package    Checksum                                    Source
> >  zeromq     e603d945685aa2bde34243ead5044bfc15dc563f    (catalog zeromq)
> >  zmq        10b634599296a142711138dab6b620db80f67738    (catalog zmq)
> >  [1 auto-installed package not shown]
> >
> >
> >
> > Collections:
> > ("/Users/erichanchrow/Library/Racket/snapshot/collects"
> >  (non-existent-path))
> > ("/Applications/Racket v6.0.0.1/collects"
> >  (".gitignore" "acks" "compiler" "data" "db" "dynext" "ffi" "file"
> "info" "info-domain" "json" "launcher" "net" "openssl" "pkg" "planet"
> "racket" "rackunit" "raco" "reader" "realm" "s-exp" "scheme" "setup" "srfi"
> "syntax" "unstable" "version" "xml"))
> >
> > Recent Internal Errors:
> > Computer Language: (("Determine language from source") (#(#t print
> mixed-fraction-e #f #t debug) (default) #() "#lang racket\n" #t #t ((main)
> (test)) #t))
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/dev/archive/attachments/20140327/d178c92b/attachment-0001.html>

Posted on the dev mailing list.