Subject: Re: Is it a bad sign...
From: rpw3@rpw3.org (Rob Warnock)
Date: Fri, 31 Oct 2008 08:05:02 -0500
Newsgroups: comp.lang.lisp
Message-ID: <XrCdnfPXm9zjn5bUnZ2dnUVZ_u-dnZ2d@speakeasy.net>
Kenny  <kentilton@gmail.com> wrote:
+---------------
| ....when apropos takes a minute to search for matches?
| 
| And speaking of minutes, it has been quite a few waiting for loop to 
| count all the symbols. I wonder why it is so slow, doing maybe 
| 1.5m/minute.
+---------------

Hmmm... I only have a ~20K symbols lying around,
but it can count them pretty fast, ~29 Msymbol/s
[I did it 1000 times to get a reliable result]:

    cmu> (time
	  (let ((count 0))
            (dotimes (i 1000)
	      (do-all-symbols (ignore)
		(declare (ignorable ignore))
		(incf count)))
	    count))
    ; Compiling LAMBDA NIL: 
    ; Compiling Top-Level Form: 

    ; Evaluation took:
    ;   0.76f0 seconds of real time
    ;   0.747812f0 seconds of user run time
    ;   0.0f0 seconds of system run time
    ;   1,420,375,501 CPU cycles
    ;   0 page faults and
    ;   368,008 bytes consed.
    ; 
    22453000
    cmu> (/ 22453000 0.76f0)

    2.9543422e7
    cmu> 

How are you counting them? I know about DO-ALL-SYMBOLS (above),
but I don't know any way to use LOOP to count symbols in more
than one package at a time...

+---------------
| And what the hell does apropos know that loop does not 
| about zooming through all the symbols?
+---------------

Hmmm... Let's see here... Well, in CMUCL, APROPOS loops over
(LIST-ALL-PACKAGES) and does a DO-SYMBOLS to iterate over each
package. Should be slower than the above, I'm guessing. Also,
we're gonna get a *bunch* of duplications, since several packages
(USE :CL) [though that really shouldn't affect the *rate*].

    cmu> (time
	  (let ((count 0))
            (dotimes (i 1000)
	      (dolist (p (list-all-packages))
		(do-symbols (ignore p)
		  (declare (ignorable ignore))
		  (incf count))))
	    count))
    ; Compiling LAMBDA NIL: 
    ; Compiling Top-Level Form: 

    ; Evaluation took:
    ;   23.66f0 seconds of real time
    ;   23.278011f0 seconds of user run time
    ;   1.6f-5 seconds of system run time
    ;   43,886,881,567 CPU cycles
    ;   0 page faults and
    ;   368,008 bytes consed.
    ; 
    87208000
    cmu> (/ 87208000 23.66f0)

    3685883.3
    cmu> 

Whoa! That's a *lot* slower!  And if done with LOOP:

    cmu> (time
	  (let ((count 0))
            (dotimes (i 10)
	      (dolist (p (list-all-packages))
		(loop for sym being the symbols in p do (incf count))))
	    count))
    ; Compiling LAMBDA NIL: 
    ; Compiling Top-Level Form: 

    ; Evaluation took:
    ;   2.55 seconds of real time
    ;   2.474624 seconds of user run time
    ;   0.007834 seconds of system run time
    ;   4,723,603,806 CPU cycles
    ;   [Run times include 0.14 seconds GC run time]
    ;   0 page faults and
    ;   15,292,712 bytes consed.
    ; 
    859200
    cmu> (/ 859200 2.55)

    336941.2
    cmu> 

(*Ouch!*)  More than 10 *times* slower!

+---------------
| And where should I put my money in my next computer?
| Is AMD any different than Intel, or shouls I save $150?
+---------------

I tend to like AMD. The above was done with a 1.855 GHz Athlon.

+---------------
| I know Vista is stupid, but is it slow?
+---------------

Dunno. The above was done on FreeBSD.  ;-}  ;-}


-Rob

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607