You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is the continuation of the work on issue #609. To evaluate the compatibility of Medley Common Lisp with ANSI Common Lisp I'm testing on Medley the code of Peter Seibel's book Practical Common Lisp.
Chapter 32, the last one, wraps up the book by discussing a number of topics, including the development of a profiler.
The code of the profiler depends on the macro library described in chapter 8 and on iterating over hash tables from loop, which Medley doesn't currently support. Therefore, for the time being I tested only the other code of the chapter.
Code
I evaluated these expressions at a XCL Exec. The commented out code is for testing the profiler.
(defunbar ()
(dotimes (i (random100000))
(+ i (random5))))
(defunbaz ()
(dotimes (i (random100000))
(+ i (random10))))
(defunfoo ()
(time (bar))
(time (baz)))
(foo)
(defmacrolabeled-time (form)
`(progn
(format*trace-output*"~2&~a"',form)
(time,form)))
(defunfoo ()
(labeled-time (bar))
(labeled-time (baz)))
(foo)
(defunfoo ()
(bar)
(baz))
; (with-timing (foo)); (show-timing-data)
(defunadd (x y) (+ x y))
; (with-timing (dotimes (i 100000) (add (random 3) i))); (show-timing-data)
(defunadd (x y)
(declare (fixnum x y))
(+ x y))
(add 32)
(defunadd (x y)
(declare (fixnum x y))
(thefixnum (+ x y)))
(add 32)
(defunadd (x y)
(declare (optimize (speed3) (safety0)))
(declare (fixnum x y))
(thefixnum (+ x y)))
(add 32)
; (with-timing (dotimes (i 100000) (add (random 3) i))); (show-timing-data)
(defunadd (x y) (+ x y))
(disassemble'add)
(defunadd (x y)
(declare (optimize (speed3) (safety0)))
(declare (fixnum x y))
(thefixnum (+ x y)))
(disassemble'add)
Session transcript
The test expressions ran with no issues and the timing information was displayed in the *Tracing-Output* window:
2/8> (defunbar ()
(dotimes (i (random100000))
(+ i (random5))))
BAR
2/9>
2/9> (defunbaz ()
(dotimes (i (random100000))
(+ i (random10))))
BAZ
2/10>
2/10> (defunfoo ()
(time (bar))
(time (baz)))
FOO
2/11>
2/11> (foo)
NIL
2/12>
2/12> (defmacrolabeled-time (form)
`(progn
(format*trace-output*"~2&~a"',form)
(time,form)))
LABELED-TIME
2/13>
2/13> (defunfoo ()
(labeled-time (bar))
(labeled-time (baz)))
New FUNCTIONS definition for FOO.
FOO
2/14>
2/14> (foo)
NIL
2/15>
2/15> (defunfoo ()
(bar)
(baz))
New FUNCTIONS definition for FOO.
FOO
2/16>
2/16> (defunadd (x y) (+ x y))
ADD
2/17>
2/17> (defunadd (x y)
(declare (fixnum x y))
(+ x y))
New FUNCTIONS definition for ADD.
ADD
2/18>
2/18> (add 32)
5
2/19>
2/19> (defunadd (x y)
(declare (fixnum x y))
(thefixnum (+ x y)))
New FUNCTIONS definition for ADD.
ADD
2/20>
2/20> (add 32)
5
2/21>
2/21> (defunadd (x y)
(declare (optimize (speed3) (safety0)))
(declare (fixnum x y))
(thefixnum (+ x y)))
New FUNCTIONS definition for ADD.
ADD
2/22>
2/22> (add 32)
5
2/23>
2/23> (defunadd (x y) (+ x y))
New FUNCTIONS definition for ADD.
ADD
2/24>
2/24> (disassemble'add)
0: 54 stkmin
2: 2 na
4: 177777 pv
6: 34 startpc
10: 141byteswapped: NILargtype: 012: 32730 frame name: "lambda in NIL"14: 0 ntsize
16: 0nlocals: 0fvaroffset: 0Info: (("X""Y"))
----
34: 100 IVAR [ivar0]
35: 101 IVAR [ivar1]
36: 324 PLUS2
37: 20RETURN40: 0 -X-
NIL
2/25>
2/25> (defunadd (x y)
(declare (optimize (speed3) (safety0)))
(declare (fixnum x y))
(thefixnum (+ x y)))
New FUNCTIONS definition for ADD.
ADD
2/26>
2/26> (disassemble'add)
0: 54 stkmin
2: 2 na
4: 177777 pv
6: 34 startpc
10: 141byteswapped: NILargtype: 012: 42400 frame name: "lambda in NIL"14: 0 ntsize
16: 0nlocals: 0fvaroffset: 0Info: (("X""Y"))
----
34: 100 IVAR [ivar0]
35: 101 IVAR [ivar1]
36: 324 PLUS2
37: 20RETURN40: 0 -X-
NIL
2/27>
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Chapter 32
This is the continuation of the work on issue #609. To evaluate the compatibility of Medley Common Lisp with ANSI Common Lisp I'm testing on Medley the code of Peter Seibel's book Practical Common Lisp.
Chapter 32, the last one, wraps up the book by discussing a number of topics, including the development of a profiler.
The code of the profiler depends on the macro library described in chapter 8 and on iterating over hash tables from
loop
, which Medley doesn't currently support. Therefore, for the time being I tested only the other code of the chapter.Code
I evaluated these expressions at a XCL Exec. The commented out code is for testing the profiler.
Session transcript
The test expressions ran with no issues and the timing information was displayed in the
*Tracing-Output*
window:Beta Was this translation helpful? Give feedback.
All reactions