File: gzip-test.lisp

package info (click to toggle)
acl2 8.6%2Bdfsg-2
  • links: PTS
  • area: main
  • in suites: trixie
  • size: 1,111,420 kB
  • sloc: lisp: 17,818,294; java: 125,359; python: 28,122; javascript: 23,458; cpp: 18,851; ansic: 11,569; perl: 7,678; xml: 5,591; sh: 3,976; makefile: 3,833; ruby: 2,633; yacc: 1,126; ml: 763; awk: 295; csh: 233; lex: 197; php: 178; tcl: 49; asm: 23; haskell: 17
file content (41 lines) | stat: -rw-r--r-- 1,665 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
(in-package 3bz)
#++ (ql:quickload '(ironclad 3bz deoxybyte-gzip chipz))
(defvar *gzip* nil)
(let* ((d (time
           (alexandria:read-file-into-byte-vector "e:/tmp/t/linux-2.2.26.tar")))
       (tmp (make-array (length d) :element-type 'octet
                                   :initial-element 0))
       (v (or *gzip*
              (setf *gzip*
                    (time
                     (multiple-value-bind (x r w)
                         (gz:deflate-vector d (make-array (* 2 (length d))
                                                          :element-type 'octet)
                           :compression 9
                           :gzip-format t)
                       (declare (ignore r))
                       (subseq x 0 w)))))))
  (format t "chipz:~%")
  (fill tmp 0)
  (with-simple-restart (continue "continue")
    (let ((x (time (chipz:decompress tmp 'chipz:gzip v))))
      (declare (ignore x))
      (assert (equalp d tmp))))

  (fill tmp 0)
  (format t "3bz:~%") ;; 0.33
  (let ((x (time (decompress-gzip (make-instance 'octet-vector-context
                                                 :octet-vector v
                                                 :boxes (make-context-boxes
                                                         :end (length v)))
                                  (make-gzip-state :output-buffer tmp)))))
    (assert (equalp (if (consp x)
                        (time (apply 'concatenate 'octet-vector x))
                        (subseq tmp 0 x))
                    d)))
  (fill tmp 0)
  (format t "gz:~%")
  (let ((x (time (gz:inflate-vector v tmp :gzip-format t))))
    (assert (equalp x d)))

  nil)