#:g1: GCL 2.9.10がgmp対応になった結果

Posted 2013-11-16 00:15:00 GMT

 桁数が大きい計算でかなり速くなったンゴw
新しいgclならMaximaあたりでパフォーマンスがかなり向上するのかも

計測に利用したスクリプト


#+sbcl (ignore-errors (require :sb-gmp))

(in-package :cl-user)

(defun ^^ (base power) (declare (optimize (debug 0) (safety 0) (speed 3)) (fixnum base power)) (loop :repeat power :for x :of-type bignum := (expt base base) :then (expt x base) :finally (return x)))

(compile '^^)

(time (= (^^ 10 6) (^^ 10 6))) (time (progn (^^ 10 6) nil)) (time (progn (^^ 10 6) nil)) (time (progn (^^ 10 6) nil)) (time (progn (^^ 10 6) nil)) (time (progn (^^ 10 6) nil))

(quit)

(time (progn (^^ 10 6) nil))を抜き出した結果

GNU Common Lisp 2.9.10: 0.029s
real time       :      0.029 secs
run-gbc time    :      0.019 secs
child run time  :      0.000 secs
gbc time        :      0.000 secs
NIL
ManKai Common Lisp 1.1.6: 0.046
real time : 0.046 secs
run time  : 0.045 secs
gc count  : 0 times
consed    : 1108304 bytes
NIL
SBCL 1.1.13 w/GMP: 0.068
Evaluation took:
  0.068 seconds of real time
  0.068004 seconds of total run time (0.068004 user, 0.000000 system)
  100.00% CPU
  163,051,965 processor cycles
  1,147,424 bytes consed

NIL

Scieneer Common Lisp 1.3.9: 1.359s
Evaluation took:
  1.359979 seconds of real time
  1.3459656 seconds of thread run time
  1.3459662 seconds of process run time
  1.348084 seconds of user run time
  0.0 seconds of system run time
  0 page faults
  5,118,784 bytes consed by this thread and
  5,118,784 total bytes consed.
NIL
Clozure CL 1.9: 4.528s
took 4,566,268 microseconds (4.566268 seconds) to run.
         2,446 microseconds (0.002446 seconds, 0.05%) of which was spent in GC.
During that period, and with 2 available CPU cores,
     4,528,283 microseconds (4.528283 seconds) were spent in user mode
         4,000 microseconds (0.004000 seconds) were spent in system mode
 1,107,808 bytes of memory allocated.
 129 minor page faults, 0 major page faults, 0 swaps.
NIL
CMU Common Lisp 20d: 7.040s
; Evaluation took:
;   7.04 seconds of real time
;   6.956434 seconds of user run time
;   0.028002 seconds of system run time
;   16,869,095,640 CPU cycles
;   [Run times include 0.01 seconds GC run time]
;   0 page faults and
;   5,653,128 bytes consed.
; 
NIL
LispWorks 6.1.1 Personal Edition: 43.434s
Timing the evaluation of (PROGN (^^ 10 6) NIL)

User time = 43.434 System time = 0.040 Elapsed time = 43.772 Allocation = 2472668 bytes 0 Page faults

Allegro CL Enterprise Edition 8.2 64-bit /
Allegro CL Free Express Edition 9.0
Error: Attempt to create an integer which is too large to represent.

comments powered by Disqus