chibi-scheme
chibi-scheme copied to clipboard
A profiler for Chibi?
This is less an issue and more 'would be lovely to have, if you could'. Have there been any previous plans for such? What would realistically need to be done to have a profiler for Chibi?
Not really - performance has never been a priority for Chibi.
There are two general approaches to profiling: 1) instrumenting and timing all (or some subset of) procedure applications, or 2) sampling snapshots of the stack to see what procedure calls are active. The former could be done purely in Scheme but the overhead might be large enough to distort results. Either could be done easily enough in C, but I'd do this as a compile-time option, storing the data in the procedure struct. Implementation should be trivial, with most work going into displaying and analyzing the results.
The (chibi optimize profile)
module gives counts (not times) for called procedures. If you have a script you run as:
chibi-scheme foo.scm
you can print the profile with
chibi-scheme -mchibi.optimize.profile -l foo.scm -e'(profile-report)'
This does slow down execution considerably enough that I'm not sure adding times would be much more help. A sampling profiler might be better in that case.