[Larceny-users] profiling code
William D Clinger
will at ccs.neu.edu
Sat Feb 14 13:37:39 EST 2009
Eduardo Cavazos wrote:
> I'm interested in finding out where *my* code is spending all it's time.
> :-) Is there a profiler for Larceny?
Yes, but it has very crude resolution. In R5RS mode:
--------
> (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))))
% topmost named procedure
98 equal?
2 run-with-profiling
% active procedures
100 r5rs-entry-point
100 repl
100 run-with-profiling
98 equal?
--------
> Available in ERR5RS mode?
Yes. By the way, the following example generalizes
to work with any R5RS library that doesn't export
macros.
--------
> (import (rnrs base)
(primitives r5rs:require run-with-profiling))
> (r5rs: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))))
% topmost named procedure
97 equal?
2 run-with-profiling
1 append
% active procedures
100 r5rs-entry-point
100 repl
100 run-with-profiling
97 equal?
1 append
--------
Will
More information about the Larceny-users
mailing list