[babel-devel] a quick speed test

Attila Lendvai attila.lendvai at gmail.com
Tue Sep 9 20:42:11 UTC 2008


thought i share it: it's 10000 octets-to-string call on the 14k long
tests/utf-8.txt, using a recent sbcl x86 64.

(sb-ext:octets-to-string octets :external-format :utf-8)

Evaluation took:
  11.451 seconds of real time
  11.336708 seconds of total run time (11.192699 user, 0.144009 system)
  [ Run times consist of 0.692 seconds GC time, and 10.645 seconds
non-GC time. ]
  99.00% CPU
  20,560,951,683 processor cycles
  1,927,564,096 bytes consed


(trivial-utf-8:utf-8-bytes-to-string octets):

Evaluation took:
  7.381 seconds of real time
  7.300456 seconds of total run time (7.248453 user, 0.052003 system)
  [ Run times consist of 0.564 seconds GC time, and 6.737 seconds non-GC time. ]
  98.90% CPU
  13,252,911,624 processor cycles
  1,524,620,560 bytes consed


(babel:octets-to-string octets :encoding :utf-8 :errorp t)

Evaluation took:
  3.173 seconds of real time
  3.144197 seconds of total run time (3.112195 user, 0.032002 system)
  [ Run times consist of 0.120 seconds GC time, and 3.025 seconds non-GC time. ]
  99.09% CPU
  5,697,700,848 processor cycles
  305,120,336 bytes consed


babel with instantiating the encodings using (safety 0)

Evaluation took:
  2.405 seconds of real time
  2.380149 seconds of total run time (2.356148 user, 0.024001 system)
  [ Run times consist of 0.208 seconds GC time, and 2.173 seconds non-GC time. ]
  98.96% CPU
  4,318,993,638 processor cycles
  305,120,000 bytes consed


(deftest x ()
  (let* ((*default-character-encoding* :utf-8)
         (octets (with-open-file (in (asdf:system-relative-pathname
:babel "tests/utf-8.txt")
                                     :element-type '(unsigned-byte 8))
                   (let* ((data (loop for byte = (read-byte in nil nil)
                                   until (null byte) collect byte)))
                     (make-array (length data) :element-type '(unsigned-byte 8)
                                 :initial-contents data)))))
    (cl:time (loop repeat 10000 do
                  (octets-to-string octets :encoding :utf-8 :errorp t)
                  ;;(trivial-utf-8:utf-8-bytes-to-string octets)
                  ;;(sb-ext:octets-to-string octets :external-format :utf-8)
                  ))))

-- 
 attila



More information about the babel-devel mailing list