I'm trying to use the cmucl profiler for the first time, and finding
some suprising results from my program. I'm not sure if i'm reading
the profiler output wrong, or if my program is really doing something
very suprising.
here is the function which the profile seems to think allocates the
most memory. But i cannot see where it is allocating any memory at
all.
Before i start ripping my program appart and changing defmethods to
defuns am i reading the profile output completely wrong? Or do i
really
need to be spending sunday afternoon in the park rather than in front
of my computer?
(defmethod get-square (( self board ) &key row col)
(declare (type fixnum row col))
(when (is-valid-square self :row row :col col)
(the square (aref (squares self) col row))))
(defmethod is-valid-square (( self board) &key row col)
(declare (type fixnum row col))
(and (<= 0 col)
(< col (num-cols self))
(<= 0 row)
(< row (num-rows self))))
Here is how the array (squares self) has been allocated.
(setf (squares self)
(make-array (list (num-rows self) (num-cols self))
:element-type 'square
:adjustable nil
:initial-contents
(loop for col from 0 below (num-cols self)
collect
(loop for row from 0 below (num-rows self)
collect
(make-instance 'square :col col :row
row)))))
here is the profiler output:
Consed | Calls | Secs | Sec/Call | Bytes/C. | Name:
-----------------------------------------------------------------------
52,237,048 | 436,105 | 8.448 | 0.00002 | 120 |
BLOCKER::VALID-INTERMEDIATE-STATE
274,591: NIL
161,514: #<Code Object "DEFMETHOD APPLY-COMBINATION
(STATE BLOCKER PLAYER COMBINATION (EQL NIL))"
{581CA4CF}>
52,439,088 | 196,812 | 7.826 | 0.00004 | 266 |
BLOCKER::APPLY-COMBINATION
95,142: NIL
51,245: #<Code Object "DEFMETHOD DOES-COMB-ATTACK
(PIECE PIECE COMBINATION)"
{582C7C0F}>
43,776: #<Code Object "DEF-CACHED-METHOD GET-SHADOW"
{581F4007}>
6,156: #<Code Object "DEFMETHOD IS-VALID-COMB
(PLAYER PIECE COMBINATION)"
{5817B3EF}>
479: #<Code Object "DEFMETHOD LEAVES-IN-CHECK
(PIECE COMBINATION)"
{581F5327}>
69,610,488 | 1,087,578 | 4.195 | 0.00000 | 64 |
BLOCKER::GET-SQUARE
685,542: NIL
400,951: #<Code Object "DEFMETHOD GET-SQUARES (STATE)"
{582D4257}>
424: NIL
248: NIL
184: #<Code Object "DEFMETHOD COMPONENT-VALUE
(GF-FREE-SQUARES)"
{58430E17}>
--
+------------------------------------------------------------------+
| [EMAIL PROTECTED] __ http://agora.rdrop.com/~jimka |
+----------------------------\/------------------------------------+
| Prejudice always masquerades as rationality until it is exposed. |
+------------------------------------------------------------------+
| None of us is truly free until all of us are free, with all our |
| rights intact and guaranteed, including the basic right to live |
| without threat or harassment. [PLAGAL] |
+------------------------------------------------------------------+