[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Typol Execution (timing)




In article <27557@sophia.inria.fr>, kuehne@isa.informatik.th-darmstadt.de (Thomas Kuehne) writes:
|> I discovered an to me unknown delay in function performance:
|> 
|> In a particular example it takes 12 seconds from the triggering of the
|> function until the function result appears in the window.
|> 
|>   2 Seconds are needed to calculate the function result
...
|>   2 Seconds are needed to put the function result into the editor
|>   and redisplay the editor window (The result is a list of 64 entries).
|> 
|>   Therefore about 8 seconds are lost between proofing the export
|>   clause and returning to LISP.
|> 

This is a bit strange. Is it cpu time or real time ?
Making performance measures is not very easy when mixing Lisp and Prolog.

I suggest that you perform some tests again, using the following hints:

In lisp, define the following function:

(de printtime () (print (runtime)))

This function will print the cpu time since the beginning of the Lisp process.
Use this function both in Lisp and in Prolog.
In prolog you have to write

getsym('printtime', PRINTTIME),
lispcall(0,0,PRINTTIME,_)

(the getsym need to be done only once in a clause)
(or in Typol  getsym("printtime", PRINTTIME) & lispcall(0,0,PRINTTIME,_) )

Then inserting "printtime" in both the lisp function and the prolog code
generated for the export clause, you will get very accurate timing.
For exemple:

(de #:as_check:as_check (prog)
   (let ((res ()))
(printtime)
      (#:prolog:send
         (catenate
            "'as_check$as_check$'("
            (#:PSP:loc prog) ").")) 
(printtime)
      res))

and

'as_check$as_check$'(__prog):-
getsym('printtime', PRINTTIME),
lispcall(0,0,PRINTIME,_),
   '$as$PROGRAM'(_prog),
   '$as$ENV'(_env),
   'gettree'(__prog, _prog),
lispcall(0,0,PRINTTIME,_),
   'as_check$0|-1->1'(_prog, _env, __prog, '$PSP$nil', _),
lispcall(0,0,PRINTTIME,_),
   '$pl_to_vtp'(_env, ___env),
   'sendvar'('res', ___env),
lispcall(0,0,PRINTTIME,_).

(some writeln("message") may help reading the trace!)

|> I would like to know what happens between the finishing of the proof
|> and returning to the LISP function.
|> Does the PROLOG Interprete need time to recover from the proof?

May be some time is necessary to pop the prolog stack, but I hope
this is less than the time to build the proof !

-- 
Send contributions to centaur@sophia.inria.fr. Registration and
administrative matters should be sent to centaur-request@sophia.inria.fr.
+---------------------------------------------------------------------------+
|     Thierry Despeyroux      | email: Thierry.Despeyroux@sophia.inria.fr   |
| I.N.R.I.A. Sophia-Antipolis | phone: +33 93 65 77 07 fax: +33 93 65 77 66 |
+---------------------------------------------------------------------------+