Skip to content

Commit

Permalink
Add benchmarking charts / page (#10)
Browse files Browse the repository at this point in the history
Add d3.js based svg chart generator

Add CCL in addition to SBCL
  • Loading branch information
arvyy authored Jun 29, 2024
1 parent b42c57e commit 54fc314
Show file tree
Hide file tree
Showing 30 changed files with 1,515 additions and 149 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build_site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
paths:
- '.github/workflows/build_site.yml'
- 'docs/**'
- 'bebchmarks/results/*'
jobs:
build_site:
runs-on: ubuntu-latest
Expand Down
44 changes: 0 additions & 44 deletions benchmarks/bf.json

This file was deleted.

44 changes: 0 additions & 44 deletions benchmarks/dyndispatch.json

This file was deleted.

44 changes: 0 additions & 44 deletions benchmarks/fib.json

This file was deleted.

58 changes: 58 additions & 0 deletions benchmarks/results/bf.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"results": [
{
"command": "ISLISP ea9f3a3",
"mean": 36.288409277999996,
"stddev": 0.01797063235438727,
"median": 36.288409277999996,
"user": 41.10920092,
"system": 0.51352572,
"min": 36.275702122,
"max": 36.301116433999994,
"times": [
36.301116433999994,
36.275702122
],
"exit_codes": [
0,
0
]
},
{
"command": "SBCL 2.3.11-2.fc40",
"mean": 15.052747479,
"stddev": 0.01587136667133626,
"median": 15.052747479,
"user": 14.934707419999999,
"system": 0.02801822,
"min": 15.041524728,
"max": 15.06397023,
"times": [
15.06397023,
15.041524728
],
"exit_codes": [
0,
0
]
},
{
"command": "CCL Version 1.12.2 (v1.12.2) LinuxX8664",
"mean": 25.562428748000002,
"stddev": 0.008270129993926637,
"median": 25.562428748000002,
"user": 25.40310142,
"system": 0.04693372,
"min": 25.556580883000002,
"max": 25.568276613000002,
"times": [
25.556580883000002,
25.568276613000002
],
"exit_codes": [
0,
0
]
}
]
}
58 changes: 58 additions & 0 deletions benchmarks/results/dyndispatch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"results": [
{
"command": "ISLISP ea9f3a3",
"mean": 62.187599836260006,
"stddev": 1.6009167640853812,
"median": 62.187599836260006,
"user": 67.04824886,
"system": 0.91126266,
"min": 61.055580736260005,
"max": 63.31961893626,
"times": [
63.31961893626,
61.055580736260005
],
"exit_codes": [
0,
0
]
},
{
"command": "SBCL 2.3.11-2.fc40",
"mean": 17.041152398759998,
"stddev": 0.010673622005624718,
"median": 17.041152398759998,
"user": 16.96024736,
"system": 0.029076159999999997,
"min": 17.03360500826,
"max": 17.04869978926,
"times": [
17.03360500826,
17.04869978926
],
"exit_codes": [
0,
0
]
},
{
"command": "CCL Version 1.12.2 (v1.12.2) LinuxX8664",
"mean": 72.07856311776001,
"stddev": 0.3821221570617602,
"median": 72.07856311776001,
"user": 71.72632186,
"system": 0.09040666,
"min": 71.80836194926,
"max": 72.34876428626,
"times": [
71.80836194926,
72.34876428626
],
"exit_codes": [
0,
0
]
}
]
}
58 changes: 58 additions & 0 deletions benchmarks/results/fib.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"results": [
{
"command": "ISLISP ea9f3a3",
"mean": 66.52795386388,
"stddev": 0.3731989672863521,
"median": 66.52795386388,
"user": 68.88263556,
"system": 0.8654894399999999,
"min": 66.26406234338,
"max": 66.79184538438,
"times": [
66.79184538438,
66.26406234338
],
"exit_codes": [
0,
0
]
},
{
"command": "SBCL 2.3.11-2.fc40",
"mean": 18.510849263380003,
"stddev": 0.06679066479994783,
"median": 18.510849263380003,
"user": 18.42351406,
"system": 0.02710294,
"min": 18.463621131380002,
"max": 18.558077395380003,
"times": [
18.558077395380003,
18.463621131380002
],
"exit_codes": [
0,
0
]
},
{
"command": "CCL Version 1.12.2 (v1.12.2) LinuxX8664",
"mean": 5.27220749188,
"stddev": 0.00906808656146702,
"median": 5.27220749188,
"user": 5.238607559999999,
"system": 0.004039439999999999,
"min": 5.26579538638,
"max": 5.27861959738,
"times": [
5.27861959738,
5.26579538638
],
"exit_codes": [
0,
0
]
}
]
}
28 changes: 23 additions & 5 deletions benchmarks/run.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,26 @@
export ISLISP="sh islisp.sh"

export SBCL_NAME="$(sbcl --noinform --non-interactive --eval '(format t "~A ~A~%" (lisp-implementation-type) (lisp-implementation-version))')"
export ISLISP_NAME="ISLISP $(git rev-parse --short HEAD)"
SBCL_EXE="${SBCL_EXE:-sbcl}"
CLOZURE_EXE="${CLOZURE_EXE:-lx86cl64}"

hyperfine 'sbcl --script fib/cl.lisp' '$ISLISP fib/islisp.lisp' --runs 3 --export-json fib.json -n "$SBCL_NAME" -n "$ISLISP_NAME"
hyperfine 'sbcl --script bf/cl.lisp' '$ISLISP bf/islisp.lisp' --runs 3 --export-json bf.json -n "$SBCL_NAME" -n "$ISLISP_NAME"
hyperfine 'sbcl --script dyndispatch/cl.lisp' '$ISLISP dyndispatch/islisp.lisp' --runs 3 --export-json dyndispatch.json -n "$SBCL_NAME" -n "$ISLISP_NAME"
SBCL_NAME="$($SBCL_EXE --noinform --non-interactive --eval '(format t "SBCL ~A~%" (lisp-implementation-version))')"
CLOZURE_NAME="$($CLOZURE_EXE -b -Q --eval '(format t "CCL ~A~%" (lisp-implementation-version))' --eval '(cl-user::quit)')"
ISLISP_NAME="ISLISP $(git rev-parse --short HEAD)"

function run_benchmark() {
hyperfine \
"$ISLISP src/$1/islisp.lisp" \
"$SBCL_EXE --script src/$1/cl.lisp" \
"$CLOZURE_EXE -l src/$1/cl.lisp --eval '(cl-user::quit)'" \
--runs 2 \
--export-json results/$1.json \
-n "$ISLISP_NAME" \
-n "$SBCL_NAME" \
-n "$CLOZURE_NAME"

node svggenerator/dist/index.js results/$1.json ../docs/images/$1.svg
}

run_benchmark fib
run_benchmark bf
run_benchmark dyndispatch
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
(result init (funcall reducer result (car list))))
((null list) result)))

(defmethod fold ((collection simple-vector) init reducer)
(defmethod fold ((collection vector) init reducer)
(do ((i 0 (+ i 1))
(result init (funcall reducer result (elt collection i))))
((>= i (length collection)) result)))
Expand All @@ -29,14 +29,14 @@
((>= i (length vec)) vec)
(setf (elt vec i) i))))

(defglobal biglist (iota 1000))
(defglobal bigvec (iota-vector 1000))
(defglobal bigvec-strings (make-array 1000 :initial-element "a"))
(defconstant biglist (iota 1000))
(defconstant bigvec (iota-vector 1000))
(defconstant bigvec-strings (make-array 1000 :initial-element "a"))

(defun do-main ()
(let ((result 0))
(do ((i 0 (+ i 1)))
((> i 50) (format t "Result: ~A~%" result))
((> i 500) (format t "Result: ~A~%" result))
(setf result (+ result (fold biglist 0 (lambda (a b) (add a b)))))
(setf result (+ result (fold bigvec 0 (lambda (a b) (add a b)))))
(setf result (+ result (length (fold bigvec-strings "" (lambda (a b) (add a b))))))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
(defun do-main ()
(let ((result 0))
(for ((i 0 (+ i 1)))
((> i 50) (format (standard-output) "Result: ~A~%" result))
((> i 500) (format (standard-output) "Result: ~A~%" result))
(setf result (+ result (fold biglist 0 (lambda (a b) (add a b)))))
(setf result (+ result (fold bigvec 0 (lambda (a b) (add a b)))))
(setf result (+ result (length (fold bigvec-strings "" (lambda (a b) (add a b))))))
Expand Down
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 54fc314

Please sign in to comment.