graph-report.lisp 2.37 KB
Newer Older
Eric Marsden's avatar
Eric Marsden committed
1
2
3
;;; graph-report.lisp
;;
;; Author: Johannes Grdem <johs@copyleft.no>
4
;; Time-stamp: <2016-05-13 12:25:11 jack>
Eric Marsden's avatar
Eric Marsden committed
5
6
7
8
;;
;;
;; When loaded into CMUCL, this should generate a report comparing the
;; performance of the different CL implementations which have been
9
;; tested. Reads the output/CL-benchmark* files to obtain data from
Eric Marsden's avatar
Eric Marsden committed
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
;; previous runs.

(defparameter *screen-width* 80)

(defun print-bar (scale)
  (if (< scale 0)
      (princ "n/a")
      (let ((chars (* (- *screen-width* 18)
		      scale)))
	(if (< chars 1)
	    (princ #\%)
	    (dotimes (i (round chars))
	      (princ #\#))))))

(defun bench-analysis ()
  (let (data implementations benchmarks impl-scores)
    (dolist (f (directory "/var/tmp/CL-benchmark*.*"))
       (with-open-file (f f :direction :input)
         (let ((*read-eval* nil))
           (push (read f) data))))
    (setf implementations (mapcar #'car data))
    (setf impl-scores (make-list (length implementations)
				 :initial-element 0))
    (setf benchmarks (reverse (mapcar #'first (cdr (first data)))))
    (dolist (b benchmarks)
      (format t "=== ~a~%" b)
      (let* ((results
	      (loop :for i in implementations
		    :collect (let* ((id (cdr (assoc i data :test #'string=)))
				    (ir (third (assoc b id :test #'string=))))
			       (if (numberp ir)
				   ir
				   -1))))
	     (ref (apply #'max results))
	     (min (apply #'min (remove -1 results))))
	(loop :for res in results
	      :for cnt from 0
	      :do (let ((i (elt implementations cnt)))
		    (format t "~&~a~5a (~6,2,0,'XF): "
			    (if (= res min)
				(progn
				  (incf (elt impl-scores cnt))
				  #\>)
			        #\Space)
			    (subseq i 0 (min (length i) 5))
			    res)
		    (print-bar (/ res ref)))))
      (terpri)
      (terpri))

    (format t "~&--- Total wins: ---------------------------------------------------------------~%")
    (loop :for impl in implementations
	  :for score in impl-scores
	  :do (progn
		(format t "~a~5a (~2d): "
			(if (= score (apply #'max impl-scores))
			    #\>
			    #\Space)
			(subseq impl 0 (min (length impl) 5))
			score)
		(dotimes (i score)
		  (princ #\#))
		(terpri)))

    (format t "~&~%===============================================================================~%")
    (dolist (impl implementations)
      (format t "~&Impl ~a: ~a~%"
	      (subseq impl 0 (min (length impl) 5))
	      impl))

    (force-output)))

(bench-analysis)
(quit)

;; EOF