Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Peter Housel
cl-bench
Commits
f466d862
Commit
f466d862
authored
May 20, 2016
by
Daniel Kochmański
Browse files
report: add html-report (wip)
parent
67b2b6b6
Changes
2
Hide whitespace changes
Inline
Side-by-side
cl-bench.asd
View file @
f466d862
...
...
@@ -31,11 +31,10 @@
:author
"Eric Marsden"
:maintainer
"Daniel 'jackdaniel' Kochmański"
:license
"Public Domain"
:depends-on
(
#:cl-bench
#:
external-program
#:log4cl
#:trivial-features
)
:depends-on
(
#:cl-bench
#:
cl-who
)
:serial
t
:components
((
:module
"report"
:components
((
:file
"lisp-exe"
)
(
:file
"report"
)
((
:file
"report"
)
(
:file
"graph-report"
)
))))
(
:file
"html-report"
)
))))
report/html-report.lisp
0 → 100644
View file @
f466d862
;;; html-report.lisp
;;;
;;; Time-stamp: <2016-05-20 14:36:27 jack>
;;;
;;; Inspired by a benchmark page example from lispm.de kindly shared
;;; by Rainer Joswig
;;;
;;; * Copyright (c) 2016 Rainer Joswig <joswig@lisp.de>
;;; * Copyright (c) 2016 Daniel Kochmański <daniel@turtleware.eu>
;;;
(
in-package
#:cl-bench
)
(
defun
read-benchmarks
()
(
let
(
data
)
(
dolist
(
f
(
directory
(
merge-pathnames
"CL-benchmark*.*"
*output-dir*
))
data
)
(
with-open-file
(
f
f
:direction
:input
)
(
let
((
*read-eval*
nil
))
(
push
(
read
f
)
data
))))))
(
defun
bench-analysis-page
()
(
let*
((
data
(
read-benchmarks
))
(
implementations
(
mapcar
#'
car
data
))
(
benchmarks
(
reverse
(
mapcar
#'
first
(
cdr
(
first
data
))))))
(
with-open-file
(
s
#P"/tmp/bench.html"
:direction
:output
:if-exists
:supersede
)
(
cl-who:with-html-output
(
s
nil
:prologue
t
)
(
cl-who:htm
(
:p
"hello world!"
)
(
:table
:border
1
(
:tr
(
:td
:style
"max-width: 100px;"
)
(
dolist
(
i
implementations
)
(
cl-who:htm
(
:th
(
cl-who:str
i
)))))
(
dolist
(
b
benchmarks
)
(
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
))))
(
best
(
apply
#'
min
results
)))
(
cl-who:htm
(
:tr
(
:th
(
cl-who:str
b
))
(
dolist
(
r
results
)
(
flet
((
cell-color
(
value
best
)
(
cond
((
>
value
(
*
4
best
))
"#b4b"
)
((
>
value
(
*
2
best
))
:red
)
((
>
value
(
*
1.6
best
))
:orange
)
((
>
value
(
*
1.25
best
))
"#4b4"
)
((
<=
value
(
*
1.25
best
))
:green
)))
(
cell-style
(
color
)
(
format
nil
"background-color: ~A;"
color
)))
(
cl-who:htm
(
:td
:style
(
cell-style
(
cell-color
r
best
))
(
cl-who:str
r
)))
)))
)))))))
benchmarks
))
(
defun
render-benchmark-table
(
values
stream
&key
(
table-type
:vertical
))
(
labels
((
br
(
&optional
(
n
1
))
(
loop
repeat
n
do
(
html2:break-line
:stream
stream
)))
(
cell
(
value
stream
&key
header-p
color
(
horizontal-alignment
:left
))
(
netscape4.0:with-table-cell
(
:stream
stream
:background
color
:header-p
header-p
:horizontal-alignment
horizontal-alignment
)
(
html3.2:with-rendition
(
:small
:stream
stream
)
(
princ
value
stream
))))
(
render-legend
()
(
html3.2:with-rendition
(
:small
:stream
stream
)
(
princ
"Legend "
stream
))
(
html4.0:with-table
(
:stream
stream
:border
0
)
(
html3.2:with-table-row
(
:stream
stream
)
(
loop
for
(
color
description
)
in
'
((
:green
"very fast"
)
(
:green-yellow
"fast"
)
(
:orange
"slow"
)
(
:red-orange
"very slow"
)
(
:red-violet
"extremely slow"
))
do
(
cell
description
stream
:color
color
)))))
(
render-table
(
values
)
(
html4.0:with-table
(
:stream
stream
:border
0
)
(
html3.2:with-table-row
(
:stream
stream
)
(
loop
for
item
in
(
first
values
)
do
(
cell
item
stream
:header-p
t
:horizontal-alignment
:center
)))
(
loop
for
(
name
.
row-values
)
in
(
rest
values
)
do
(
html3.2:with-table-row
(
:stream
stream
)
(
cell
name
stream
:header-p
t
:horizontal-alignment
:right
)
(
flet
((
cell-color
(
value
best
)
(
cond
((
>
value
(
*
4
best
))
:red-violet
)
((
>
value
(
*
2
best
))
:red-orange
)
((
>
value
(
*
1.6
best
))
:orange
)
((
>
value
(
*
1.25
best
))
:green-yellow
)
((
<=
value
(
*
1.25
best
))
:green
))))
(
loop
with
best
=
(
reduce
'min
(
remove-if-not
#'
numberp
row-values
))
for
value
in
row-values
for
color
=
(
and
value
(
cell-color
value
best
))
do
(
if
color
(
cell
value
stream
:color
color
)
(
cell
(
if
(
numberp
value
)
value
"no value"
)
stream
))))))))
(
render-remarks
()
(
html3.2:with-rendition
(
:small
:stream
stream
)
(
princ
*benchmark-comments*
stream
)))
(
render-tables-1
()
(
princ
"Mac OS X 10.2.6/8, Apple Powerbook G4, 800 Mhz, 1 GB RAM, 20. August 2003"
stream
)
(
br
2
)
(
html4.0:with-table
(
:stream
stream
:border
0
)
(
html3.2:with-table-row
(
:stream
stream
)
(
html3.2:with-table-cell
(
:stream
stream
)
(
princ
"full optimizations"
stream
))
(
html3.2:with-table-cell
(
:stream
stream
)
(
princ
"no optimizations"
stream
)))
(
html3.2:with-table-row
(
:stream
stream
)
(
html3.2:with-table-cell
(
:stream
stream
)
(
render-table
(
first
values
)))
(
html3.2:with-table-cell
(
:stream
stream
)
(
render-table
(
second
values
)))))
(
br
2
)
(
princ
"Mac OS X 10.3, Apple Powerbook G4, 1.33 Ghz, 1 GB RAM, 3. November 2003"
stream
)
(
br
2
)
(
render-table
(
third
values
))
(
br
))
(
render-tables-2
()
(
br
2
)
(
html4.0:with-table
(
:stream
stream
:border
0
)
(
html3.2:with-table-row
(
:stream
stream
)
(
html3.2:with-table-cell
(
:stream
stream
)
(
princ
"Ubuntu GNU Linux, ODROID XU, 1.6 Ghz ARM Cortex-A15,<br>2 GB RAM, 20. November 2015, full optimizations"
stream
))
(
html3.2:with-table-cell
(
:stream
stream
)
(
princ
"Ubuntu GNU Linux, ODROID-U3, 1.7 Ghz ARM Cortex-A9,<br>2 GB RAM, 6. June 2015, full optimizations"
stream
))
(
html3.2:with-table-cell
(
:stream
stream
)
(
princ
"Mac OS X 10.9, Apple Mac mini 2012, 2.6 Ghz Intel Core i7,<br>16 GB RAM, 4. October 2013, full optimizations"
stream
))
(
html3.2:with-table-cell
(
:stream
stream
)
(
princ
"Ubuntu GNU Linux, ODROID-XU, 1.6 Ghz ARM Cortex-A15,<br>2 GB RAM, 3. October 2013, full optimizations"
stream
))
(
html3.2:with-table-cell
(
:stream
stream
)
(
princ
"Mac OS X 10.6.2, Apple MacBook Pro, Intel Core 2 Duo 2.33 Ghz,<br>24. Jan 2010, full optimizations"
stream
))
(
html3.2:with-table-cell
(
:stream
stream
)
(
princ
"Mac OS X 10.4.9, Apple MacBook Pro, Intel Core 2 Duo 2.33 Ghz,<br>6. March 2007"
stream
))
(
html3.2:with-table-cell
(
:stream
stream
)
(
princ
"Mac OS X 10.4.6, Apple MacBook, Intel Core Duo 1.83 Ghz,<br>28. May 2006"
stream
))
(
html3.2:with-table-cell
(
:stream
stream
)
(
princ
"Mac OS X 10.3.5, Apple PowerMac G5, Dual 2.5 Ghz,<br>19. October 2004"
stream
))
(
html3.2:with-table-cell
(
:stream
stream
)
(
princ
"Mac OS X 10.2.8, Apple PowerMac G5, Dual 2 Ghz,<br>15. November 2003"
stream
))
(
html3.2:with-table-cell
(
:stream
stream
)
(
princ
"Mac OS X 10.3, Apple Powerbook G4, 1.33 Ghz,<br> 1 GB RAM, 3. November 2003"
stream
))
(
html3.2:with-table-cell
(
:stream
stream
)
(
princ
"Mac OS X 10.2.6/8, Apple Powerbook G4, 800 Mhz,<br> 1 GB RAM, 20. August 2003, full optimizations"
stream
))
(
html3.2:with-table-cell
(
:stream
stream
)
(
princ
"Mac OS X 10.2.6/8, Apple Powerbook G4, 800 Mhz,<br>1 GB RAM, 20. August 2003, no optimizations"
stream
))
)
(
html3.2:with-table-row
(
:stream
stream
)
(
loop
for
i
from
11
downto
0
do
(
html3.2:with-table-cell
(
:stream
stream
)
(
render-table
(
elt
values
i
))))))
(
br
))
(
render-tables-3
()
(
br
2
)
(
html4.0:with-table
(
:stream
stream
:border
0
)
(
html3.2:with-table-row
(
:stream
stream
)
(
html3.2:with-table-cell
(
:stream
stream
)
(
princ
"Mac OS X 10.4.9, Apple MacBook Pro, Intel Core 2 Duo 2.33 Ghz,<br> March 2007"
stream
))
(
html3.2:with-table-cell
(
:stream
stream
)
(
princ
"Mac OS X 10.4.6, Apple MacBook, Intel Core Duo 1.83 Ghz,<br> 28. May 2006"
stream
))
(
html3.2:with-table-cell
(
:stream
stream
)
(
princ
"Mac OS X 10.4.6, Apple PowerMac G5, PowerPC 970fx 2*2.5 Ghz,<br> 28. May 2006"
stream
)))
(
html3.2:with-table-row
(
:stream
stream
)
(
html3.2:with-table-cell
(
:stream
stream
)
(
render-table
(
first
values
)))
(
html3.2:with-table-cell
(
:stream
stream
)
(
render-table
(
second
values
)))
(
html3.2:with-table-cell
(
:stream
stream
)
(
render-table
(
third
values
)))))
(
br
)))
(
with-paragraph
(
:stream
stream
:title
"Benchmarks for some Lisps under Mac OS X"
)
(
br
1
)
(
html3.2:with-rendition
(
:small
:stream
stream
)
(
princ
"The "
stream
)
(
html2:note-anchor
"benchmark code"
:reference
"http://www.chez.com/emarsden/downloads/"
:stream
stream
)
(
princ
" is from Eric Marsden, based on the Gabriel Benchmarks."
stream
))
(
br
2
)
(
render-legend
)
(
br
2
)
(
ecase
table-type
(
:vertical
(
render-tables-1
))
(
:horizontal
(
render-tables-2
))
(
:hidden
(
render-tables-3
)))
(
render-remarks
))))
(
defun
generate-benchmark-page
(
url
stream
)
(
generate-basic-page
url
stream
:render-function
(
lambda
(
url
stream
)
(
declare
(
ignore
url
))
(
render-benchmark-table
(
list
*benchmark1-values*
*benchmark-values*
*benchmark2-values*
*benchmark3-values*
*benchmark4-values*
*benchmark5-values*
*benchmark8-values*
*benchmark9-values*
*benchmark10-values*
*benchmark11-values*
*benchmark13-values*
*benchmark14-values*
)
stream
:table-type
:horizontal
))
:title
"Rainer Joswig's Home, Lisp Benchmarks"
))
(
defparameter
*benchmark14-values*
'
((
"Benchmark"
"SBCL 1.3.0"
"CCL 1.11"
"LispWorks 7"
"GCL 2.6.12"
"ECL 16.0.0"
"ABCL 1.3.3"
"CLISP 2.49"
)
(
BOYER
0.565
0.61
1.645
0.96
1.785
1.556
5.595
)
(
BROWSE
0.23
0.245
0.225
0.61
0.545
0.723
1.205
)
(
DDERVIV
0.27
0.145
0.24
0.43
1.33
0.788
1.625
)
(
DERIV
0.295
0.255
0.455
0.75
2.455
1.498
2.915
)
(
DESTRUCTIVE
0.43
0.33
0.26
0.35
0.935
2.188
2.47
)
(
DIV2-TEST-1
0.22
0.18
0.335
0.47
1.59
1.014
2.375
)
(
DIV2-TEST-2
0.115
0.095
0.17
0.2
0.83
0.496
1.195
)
(
FFT
0.085
0.075
0.2
2.94
0.105
0.75
5.625
)
(
FRPOLY/FIXNUM
0.35
0.2
0.405
0.52
0.75
1.282
3.195
)
(
FRPOLY/BIGNUM
0.655
0.465
1.13
1.16
0.815
1.104
2.8
)
(
FRPOLY/FLOAT
0.245
0.305
0.355
0.26
0.54
0.718
2.075
)
(
PUZZLE
0.125
0.39
0.225
1.21
0.675
2.045
4.225
)
(
CTAK
0.615
0.79
0.7
1.43
1.88
10.475
4.64
)
(
TAK
0.425
0.285
0.36
0.88
0.67
0.791
5.355
)
(
RTAK
0.425
0.29
0.36
0.89
0.67
0.581
5.355
)
(
TAKL
0.61
0.725
0.69
0.63
0.67
0.975
7.66
)
(
STAK
0.815
0.925
0.7
0.58
1.18
11.266
5.08
)
(
FPRINT
4.315
1.25
0.435
0.36
0.98
1.553
0.32
)
(
TRAVERSE
0.9
1.025
1.055
1.45
5.825
3.017
11.21
)
(
TRIANGLE
0.9
1.085
1.03
1.79
2.24
3.181
20.14
)
(
CASCOR
0.74
2.685
NIL
NIL
1.15
10.915
48.125
)
(
RICHARDS
0.37
0.565
0.605
0.36
3.375
1.892
6.09
)
(
FACTORIAL
0.13
0.055
0.215
0.35
0.185
0.314
0.525
)
(
FIB
0.305
0.05
0.07
0.12
0.31
0.137
1.02
)
(
BIGNUM/ELEM-100-1000
0.305
0.675
0.545
0.69
0.095
1.117
0.07
)
(
BIGNUM/ELEM-1000-100
0.69
3.35
0.94
1.48
0.11
0.889
0.24
)
(
BIGNUM/ELEM-10000-1
0.82
5.015
0.87
0.88
0.14
0.573
0.21
)
(
BIGNUM/PARI-100-10
0.055
0.655
0.06
0.02
0.015
0.207
0.045
)
(
BIGNUM/PARI-200-5
0.195
7.965
0.195
0.07
0.075
0.411
0.14
)
(
HASH-STRINGS
0.05
0.115
0.04
0.23
0.07
0.587
0.165
)
(
HASH-INTEGERS
0.13
0.35
0.175
0.2
0.245
0.841
0.535
)
(
BOEHM-GC
2.97
2.52
1.76
6.56
8.76
14.225
15.645
)
(
CLOS/DEFCLASS
1.74
0.395
0.245
NIL
0.425
7.314
0.805
)
(
CLOS/DEFMETHOD
3.91
0.145
0.195
NIL
0.285
3.974
0.23
)
(
CLOS/INSTANTIATE
2.445
2.1
1.3
NIL
6.205
15.559
2.135
)
(
CLOS/METHODCALLS
15.765
2.575
4.255
NIL
3.835
29.736
6.625
)
(
CLOS/METHOD+AFTER
3.365
1.595
2.145
NIL
2.49
20.839
4.34
)
(
CLOS/COMPLEX-METHODS
2.42
0.915
0.505
NIL
53.965
20.42
NIL
)
(
1D-ARRAYS
0.645
0.255
0.355
1.46
0.8
0.888
4.4
)
(
2D-ARRAYS
0.575
0.415
0.245
1.29
0.49
4.069
5.91
)
(
BITVECTORS
0.28
0.05
0.07
0.3
0.92
0.205
0.515
)
(
FILL-STRINGS
0.24
0.175
0.405
0.99
0.435
2.296
1.195
)
(
FILL-STRINGS/ADJUSTABLE
0.145
0.135
0.195
0.02
0.035
0.179
0.385
)))
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment