Skip to content

Commit

Permalink
Added Brainfold benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
Izaakwltn committed Oct 17, 2024
1 parent 87e9831 commit 35f8e43
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 5 deletions.
2 changes: 1 addition & 1 deletion examples/small-coalton-programs/small-coalton-programs.asd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(asdf:defsystem #:small-coalton-programs
:depends-on (#:coalton)
:depends-on (#:coalton #:coalton/benchmarking)
:pathname "src/"
:serial t
:components ((:file "package")
Expand Down
44 changes: 40 additions & 4 deletions examples/small-coalton-programs/src/brainfold.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
(cl:defpackage #:brainfold
(:use
#:coalton
#:coalton-prelude)
#:coalton-prelude
#:coalton-benchmarking)
(:local-nicknames
(#:vec #:coalton-library/vector)
(#:iter #:coalton-library/iterator)
Expand All @@ -31,12 +32,14 @@
(:export
#:eval
#:run-program
#:run-file

#:run-file)
(:export
;; Examples
#:hello-world
#:gnarly-hello-world
#:squares))
#:squares)
(:export
#:run-brainfold-benchmarks))

(in-package #:brainfold)

Expand Down Expand Up @@ -305,3 +308,36 @@

(define (squares)
(run-program "++++[>+++++<-]>[<+++++>-]+<+[>[>+>+<<-]++>>[<<+>>-]>>>[-]++>[-]+>>>+[[-]++++++>>>]<<<[[<++++++++<++>>-]+<.<[>----<-]<]<<[>>>>>[>>>[-]+++++++++<[>-<-]+++++++++>[-[<->-]+[<<<]]<[>+<-]>]<<-]<<-]")))

(define-benchmark bf-hello 1
(fn ()
(hello-world)
Unit))

(define-benchmark bf-hello10 10
(fn ()
(hello-world)
Unit))

(define-benchmark bf-gnarly 1
(fn ()
(gnarly-hello-world)
Unit))

(define-benchmark bf-gnarly10 10
(fn ()
(gnarly-hello-world)
Unit))

(define-benchmark squares 1
(fn ()
(squares)
Unit))

(define-benchmark squares10 10
(fn ()
(squares)
Unit))

(cl:defun run-brainfold-benchmarks ()
(run-package-benchmarks "brainfold"))

0 comments on commit 35f8e43

Please sign in to comment.