William D Clinger wrote: >> (require 'profile) > #t >> (run-with-profiling > (lambda () > (let* ((x1 (vector->list (make-vector 1000000 13))) > (x2 (append x1 '())) > (y (vector->list (make-vector 1000000 x1))) > (z (vector->list (make-vector 1000000 x2)))) > (equal? y z))))
It would be nice if 'run-with-profiling' returned the result of the calling the thunk, so as to make it easier to slip into existing code. It would also be nice to have a 'profile' macro which wrapped the expression in a thunk for you. With those two changes, 'profile' would act much like 'time'. This works for me: ---------------------------------------------------------------------- (define (run-with-profiling* thunk) (define val #f) (if (not (procedure? thunk)) (assertion-violation 'run-with-profiling "argument should be thunk" thunk)) (reset-profiler!) (start-profiler!) (set! val (thunk)) (stop-profiler!) (report-profiler!) val) (define-macro (profile expr) `(run-with-profiling* (lambda () ,expr))) ---------------------------------------------------------------------- If they are sound, can we add them to 'profile.sch'? Ed _______________________________________________ Larceny-users mailing list Larceny-users@lists.ccs.neu.edu https://lists.ccs.neu.edu/bin/listinfo/larceny-users