Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!rutgers!princeton!allegra!alice!trickey From: trickey@alice.UUCP Newsgroups: comp.lang.lisp Subject: Common Lisp Performance Analysis Message-ID: <6632@alice.uUCp> Date: Tue, 10-Feb-87 21:18:29 EST Article-I.D.: alice.6632 Posted: Tue Feb 10 21:18:29 1987 Date-Received: Thu, 12-Feb-87 02:26:07 EST Organization: AT&T Bell Laboratories, Murray Hill NJ Lines: 33 What do people do to find out where the time is going in a large common lisp program? I recently cut the run time of a large compiled-lisp program by a factor of 5 by finding out that my elegant general all-shortest-paths finding routine (taking a node list and adjacency function, returning functions for the shortest path and length between pairs) was taking 90% of the time, and needed replacing by a faster specialized one that left the answer in a global. I found this by inserting calls to get-internal-cpu-time in various places. But it seems like there should be something like the time profiling we're used to with C, etc. It seems possible to put in a SYSCALL of profil (I'm using Lucid Common Lisp 1.2, on a Sun), and analyzing the results. (Garbage collection should be turned off, assumptions made about how the loader loads .lbins). Has anyone done this? It's possible to redefine defun to accumulate counts, or even times, but the timing resolution isn't fine enough for the latter to work for all but the longest functions. You might be interested to know that I've implemented the same program (a graph layout program) in Common Lisp and C++, about 8000 lines each. The C++ version is now 2 to 3 times faster (it was 10-20 times faster before I discovered the shortest-paths thing, about the only place where there was a significant difference between the two versions). This is better than I expected for Common Lisp. I think it is because so much time is spent doing shortest paths, and I spent time making the CL version as fast as possible. Howard Trickey, AT&T Bell Laboratories {allegra,research}!trickey