With the purpose of profiling a LISP program under CLISP I
downloaded METERING from the CMU lisp repository
(http://www-cgi.cs.cmu.edu/afs/cs.cmu.edu/project/ai-repository/ai/lang/lisp/code/tools/metering/0.html).
But the results I obtained were absolutely strange (both programs were
previously compiled):
Cons
% % Per Total Total
Function Time Cons Calls Sec/Call Call Time Cons
-----------------------------------------------------------------------------
[...]
YYY: 0.06 0.13 2404 0.001267 11695 3.046344 28115644
[...]
-----------------------------------------------------------------------------
TOTAL: 0.98 0.99 427133 50.930138 208439916
Estimated monitoring overhead: 5.98 seconds
Estimated total monitoring overhead: 6.17 seconds
Where the YYY function is just simple math:
(defun yyy (time vars inputs)
(declare (ignore time))
(let ((xx (second vars))
(y (third vars))
(yy (fourth vars))
(f (first inputs)))
(/ (- (* 2 *mp* (+ f (- (* *kc* xx)) (* *w* *mp* (sqr yy) (cos y))) (sin y))
(* 2 *g* *mp* (+ *mc* *mp*) (cos y))
(* *kp* yy (+ (* 2 *mc*) *mp* (* *mp* (cos (* 2 y))))))
(* *w* *mp* (+ (* 2 *mc*) *mp* (* *mp* (cos (* 2 y))))))))
Can anyone explain how this can generate eleven thousand conses per
call????
Cheers,
--
*** Rodrigo Martins de Matos Ventura <····@isr.ist.utl.pt>
*** Web page: http://www.isr.ist.utl.pt/~yoda
*** Teaching Assistant and PhD Student at ISR:
*** Instituto de Sistemas e Robotica, Polo de Lisboa
*** Instituto Superior Tecnico, Lisboa, PORTUGAL
*** PGP fingerprint = 0119 AD13 9EEE 264A 3F10 31D3 89B3 C6C4 60C6 4585
>>>>> "Christopher" == Christopher J Vogt <····@computer.org> writes:
Christopher> Rodrigo Ventura wrote:
>> Can anyone explain how this can generate eleven thousand conses
>> per call????
Christopher> What are the values being operated on? If they are
Christopher> bignums (and very big bignums) it could generate
Christopher> thousands of conses.
It operates on floats, but I'm not sure what kind of
floats. However I needed the following to prevent numerical problems I
was experiencing:
;; --- LISP Configuration ---
(defparameter *FLOATING-POINT-CONTAGION-ANSI* t)
(defparameter *WARN-ON-FLOATING-POINT-CONTAGION* nil)
The YYY function is used iteratively, starting with hardcoded
constants defined, for instance, as "1.4L0".
I guess that one of the possibilities is to refrain CLISP from
using floats too large. How can I do this? Without the
*FLOATING-POINT-CONTAGION-ANSI* parameter I get lots of warnings. Does
it help to "declare" the function arguments as fixnums?
Cheers,
--
*** Rodrigo Martins de Matos Ventura <····@isr.ist.utl.pt>
*** Web page: http://www.isr.ist.utl.pt/~yoda
*** Teaching Assistant and PhD Student at ISR:
*** Instituto de Sistemas e Robotica, Polo de Lisboa
*** Instituto Superior Tecnico, Lisboa, PORTUGAL
*** PGP fingerprint = 0119 AD13 9EEE 264A 3F10 31D3 89B3 C6C4 60C6 4585
Rodrigo Ventura <····@isr.ist.utl.pt> writes:
>
> >>>>> "Christopher" == Christopher J Vogt <····@computer.org> writes:
>
> Christopher> Rodrigo Ventura wrote:
> >> Can anyone explain how this can generate eleven thousand conses
> >> per call????
>
> Christopher> What are the values being operated on? If they are
> Christopher> bignums (and very big bignums) it could generate
> Christopher> thousands of conses.
>
> It operates on floats, but I'm not sure what kind of
> floats. However I needed the following to prevent numerical problems I
> was experiencing:
Note the word: "problem"
> ;; --- LISP Configuration ---
> (defparameter *FLOATING-POINT-CONTAGION-ANSI* t)
> (defparameter *WARN-ON-FLOATING-POINT-CONTAGION* nil)
>
> The YYY function is used iteratively, starting with hardcoded
> constants defined, for instance, as "1.4L0".
>
> I guess that one of the possibilities is to refrain CLISP from
> using floats too large. How can I do this? Without the
> *FLOATING-POINT-CONTAGION-ANSI* parameter I get lots of warnings. Does
Note the word: "warnings"
> it help to "declare" the function arguments as fixnums?
Just to be clear: warnings are not necessarily problems nor are an absence
of warnings non-problems.
Warnings are telling you something. You should seek to understand
them, not merely to muffle them. By muffling them, you may not have
disposed of the problem--you may just have made it harder to debug.
I can't speak for CLISP specifically, since I don't use it myself, but
it seems very likely that this set of issues is the locus of your
problems. It may be that long floats are heap-consed, and it may be
that the individual results of all your numerics are getting
heap-consed and then immediately discarded, for example, creating a
lot of garbage. The warnings you're asking not to see might be
telling you the places where this is happening. (Or maybe it's
something else entirely.) But whatever the case, if you don't know
the precise cause of a warning well enough to be sure that you don't
need to be told when it's happening, I recommend not turning it off.
Just my opinion...
On 31 Mar 2001 20:30:35 +0100, Rodrigo Ventura <····@isr.ist.utl.pt> wrote:
> With the purpose of profiling a LISP program under CLISP I
> downloaded METERING from the CMU lisp repository
A more up to date version is included with CLOCC (Common Lisp Open Code
Collection):
http://sourceforge.net/projects/clocc
Paolo
--
EncyCMUCLopedia * Extensive collection of CMU Common Lisp documentation
http://cvs2.cons.org:8000/cmucl/doc/EncyCMUCLopedia/
Rodrigo Ventura <····@isr.ist.utl.pt> writes:
> With the purpose of profiling a LISP program under CLISP I
> downloaded METERING from the CMU lisp repository
> (http://www-cgi.cs.cmu.edu/afs/cs.cmu.edu/project/ai-repository/ai/lang/lisp/code/tools/metering/0.html).
> But the results I obtained were absolutely strange (both programs were
> previously compiled):
>
> Cons
> % % Per Total Total
> Function Time Cons Calls Sec/Call Call Time Cons
> -----------------------------------------------------------------------------
> [...]
> YYY: 0.06 0.13 2404 0.001267 11695 3.046344 28115644
> [...]
> -----------------------------------------------------------------------------
> TOTAL: 0.98 0.99 427133 50.930138 208439916
> Estimated monitoring overhead: 5.98 seconds
> Estimated total monitoring overhead: 6.17 seconds
>
> Where the YYY function is just simple math:
>
> (defun yyy (time vars inputs)
> (declare (ignore time))
> (let ((xx (second vars))
> (y (third vars))
> (yy (fourth vars))
> (f (first inputs)))
> (/ (- (* 2 *mp* (+ f (- (* *kc* xx)) (* *w* *mp* (sqr yy) (cos y))) (sin y))
> (* 2 *g* *mp* (+ *mc* *mp*) (cos y))
> (* *kp* yy (+ (* 2 *mc*) *mp* (* *mp* (cos (* 2 y))))))
> (* *w* *mp* (+ (* 2 *mc*) *mp* (* *mp* (cos (* 2 y))))))))
>
> Can anyone explain how this can generate eleven thousand conses per
> call????
As others have pointed out, this is likely consing floats.
But the question in my mind is, ``So what?'' Your profile indicates
that this is not taking a substantial amount of the total space or
runtime.
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 80,000 Newsgroups - 16 Different Servers! =-----