forked from ecraven/r7rs-benchmarks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bench
executable file
·1355 lines (1140 loc) · 33.8 KB
/
bench
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
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#! /usr/bin/env bash
# For running R7RS benchmarks.
#
# Please report any errors or extensions to the author:
#
# William D Clinger (will@ccs.neu.edu)
#
# This script was adapted from the similar script in
# test/Benchmarking/R6RS, which was itself loosely modelled
# after Marc Feeley's script for benchmarking R5RS systems,
# with additional contributions by Harvey Stein.
#
# Usage:
#
# % cd test/Benchmarking/R7RS
# % ./bench <system> <benchmark>
#
# For the current list of systems and benchmarks, run this
# script with no arguments.
#
# The benchmarks must be contained within a src subdirectory
# of the directory in which this script is run.
#
# The inputs to the benchmarks must be contained within an
# inputs subdirectory of the directory in which this script
# is run.
OSNAME="`( uname )`"
# If a benchmark takes longer than an hour to run, then it's
# probably in some kind of infinite loop.
# CPU_LIMIT=3600
# ecraven changed this to 5 minutes
CPU_LIMIT=${CPU_LIMIT:-"300"}
# The following definitions are not in use, but using them
# might improve the script.
HOME="`( pwd )`"
SRC="${HOME}/src"
INPUTS="${HOME}/inputs"
################################################################
# These are Larceny's R6RS benchmarks revised for R7RS, with
# the following omissions (and reasons):
#
# dderiv (used hashtables)
# cat2 (used UTF-8, so it's usually the same as cat)
# cat3 (used UTF-16, which is not portably available in R7RS small)
# read0 (extensive testing of R6RS lexical syntax needs conversion)
# read2 (used UTF-8, so it's usually the same as read1)
# read3 (used UTF-16, which is not portably available in R7RS small)
# bibfreq (used hashtables)
# bibfreq2 (used hashtables)
# normalization (used Unicode normalization)
# listsort (used R6RS list-sort)
# vecsort (used R6RS vector-sort)
# hashtable0 (used hashtables)
#
# In addition, the bv2string benchmark was reduced to testing
# conversions between strings and UTF-8.
GABRIEL_BENCHMARKS="browse deriv destruc diviter divrec puzzle triangl tak takl ntakl cpstak ctak"
NUM_BENCHMARKS="fib fibc fibfp sum sumfp fft mbrot mbrotZ nucleic pi pnpoly ray simplex"
KVW_BENCHMARKS="ack array1 string sum1 cat tail wc"
IO_BENCHMARKS="read1"
OTHER_BENCHMARKS="compiler conform dynamic earley graphs lattice matrix maze mazefun nqueens paraffins parsing peval primes quicksort scheme slatex chudnovsky"
GC_BENCHMARKS="nboyer sboyer gcbench mperm"
SYNTH_BENCHMARKS="equal bv2string"
ALL_BENCHMARKS="$GABRIEL_BENCHMARKS $NUM_BENCHMARKS $KVW_BENCHMARKS $IO_BENCHMARKS $OTHER_BENCHMARKS $GC_BENCHMARKS $SYNTH_BENCHMARKS"
ALL_SYSTEMS="bigloo bones chez chibi chicken cyclone femtolisp gambitc gauche gerbil guile ironscheme kawa larceny loko mit mosh picrin racket s7 s9fes sagittarius stklos tr7 ypsilon" # tinyscheme seems to run out of memory or time on *every* benchmark :-/
# petite-chez chickencsi
# foment owllisp rhizome rscheme scheme48 vicare
################################################################
NB_RUNS=1
clean=true
options=""
# Where the tested systems are located on our machines.
setup ()
{
case ${OSNAME} in
"Linux")
APPS="/usr/local/bin"
HENCHMAN="/home/henchman/bin/larceny"
;;
"Darwin")
;;
esac
# For both Solaris and Linux machines.
BIGLOO=${BIGLOO:-"bigloo"}
BONES=${BONES:-"bones"}
CHEZ=${CHEZ:-"chez"}
CHIBI=${CHIBI:-"chibi-scheme"}
CHICKEN_CSC=${CHICKEN_CSC:-"chicken-csc"}
CHICKEN_CSI=${CHICKEN_CSI:-"chicken-csi"}
CYCLONE=${CYCLONE:-"cyclone"}
FEMTOLISP=${FEMTOLISP:-"flisp"}
FOMENT=${FOMENT:-"foment"}
GAMBITC=${GAMBITC:-"gambitc"}
GAUCHE=${GAUCHE:-"gosh"}
GXC=${GXC:-"gxc"}
GUILD=${GUILD:-"guild"}
GUILE=${GUILE:-"guile"}
HUSKI=${HUSKI:-"huski"}
JAVA=${JAVA:-"java"}
IRONSCHEME=${IRONSCHEME:-"ironscheme"}
KAWA=${KAWA:-"kawa"}
KAWAJAR=${KAWAJAR:-/usr/share/kawa/lib/kawa.jar}
LARCENY=${LARCENY:-"larceny"}
LOKO=${LOKO:-"loko"}
MIT=${MIT:-"mit-scheme"}
MOSH=${MOSH:-"mosh-scheme"}
OL=${OL:-"ol"}
PETIT=${PETIT:-"../../../../PetitGit/larceny"}
PETITE_CHEZ=${PETITE_CHEZ:-"petite"}
PICRIN=${PICRIN:-"picrin"}
RACKET=${RACKET:-"racket"}
RACKET_RACO=${RACKET_RACO:-"raco"}
RSCHEME=${RSCHEME:-"fshell"}
RSCHEME_RSC=${RSCHEME_RSC:-"rsc"}
RHIZOME_PISC=${RHIZOME_PISC:-"pisc"}
RHIZOME_PISL=${RHIZOME_PISL:-"pisl"}
SAGITTARIUS=${SAGITTARIUS:-"sagittarius"}
SCHEME48=${SCHEME48:-"scheme48"}
S7=${S7:-"s7"}
S9fES=${S9fES:-"s9"}
SISC=${SISC:-"sisc"}
STALIN=${STALIN:-"stalin"}
STKLOS=${STKLOS:-"stklos"}
TINYSCHEME=${TINYSCHEME:-"tinyscheme"}
TR7I=${TR7I:-"tr7i"}
VICARE=${VICARE:-"vicare"}
YPSILON=${YPSILON:-"ypsilon"}
}
setup
# -----------------------------------------------------------------------------
error ()
{
echo $1
echo '
Usage: bench [-r runs] <system> <benchmark>
<system> is the abbreviated name of the implementation to benchmark:
bigloo for Bigloo
bones for Bones
chez for Chez Scheme
chibi for Chibi
chicken for Chicken (compiled)
chickencsi for Chicken (interpreted)
cyclone for Cyclone
foment for Foment
gambitc for GambitC Scheme
gauche for Gauche
gerbil for Gerbil Scheme
guile for Guile Scheme
husk for Husk
ironscheme for IronScheme
kawa for Kawa
larceny for Larceny
loko for Loko Scheme
mit for MIT/GNU Scheme
mosh for Mosh
owllisp for Owl-Lisp
petit for Petit Larceny
petite-chez for Petite Chez
picrin for Picrin
racket for Racket
rhizome for Rhizome
rscheme for RScheme
sagittarius for Sagittarius
scheme48 for Scheme48
s7 for S7
s9fes for S9fES (Scheme 9 from Empty Space)
sisc for SISC (Second Implementation of Scheme)
stalin for Stalin
stklos for STklos
tinyscheme for TinyScheme
tr7 for TR7
vicare for Vicare
ypsilon for Ypsilon
all for all of the above
<benchmark> is the name of the benchmark(s) to run:
all for all of the usual benchmarks
fib for the fib benchmark
"fib ack" for the fib and ack benchmarks
runs is the number of times to run each benchmark (default is 1).'
exit
}
# -----------------------------------------------------------------------------
# FIXME: DANGER! DANGER! DANGER!
# DON'T USE THIS UNTIL IT'S BEEN FIXED!
cleanup ()
{
if [ "$clean" = "true" ] ; then
# It's true that technically speaking, we should be in the build
# directory when this fcn is called. Thus, we should be able to
# just do rm *. However, that's kind of dangerous, so instead,
# we delete files newer than the mark file that evaluate () makes.
for x in * ; do
if [ $x -nt clean_newer_than_me ] ; then
rm $x
fi
done
fi
rm clean_newer_than_me
}
evaluate ()
{
# echo > clean_newer_than_me
sleep 1
{
echo
echo Testing $1 under ${NAME}
make_src_code $1
echo Compiling...
ulimit -t ${CPU_LIMIT}
echo $COMP "${TEMP}/$1.${EXTENSION}" "${TEMP}/$1.${EXTENSIONCOMP}"
$COMP "${TEMP}/$1.${EXTENSION}" "${TEMP}/$1.${EXTENSIONCOMP}"
if [ $? -ne 0 ]
then
echo "+!CSVLINE!+${2},$1,COMPILEERROR"
skiprun="true"
fi
i=0
if [ "$skiprun" != "true" ]
then
while [ "$i" -lt "$NB_RUNS" ]
do
echo Running...
ulimit -t ${CPU_LIMIT}
$EXEC "${TEMP}/$1.${EXTENSIONCOMP}" "${INPUTS}/$1.input"
status=$?
if [ $status -eq 137 ] # killed by ulimit timeout
then
echo "+!CSVLINE!+${2},$1,ULIMITKILLED"
elif [ $status -ne 0 ]
then
echo "+!CSVLINE!+${2},$1,CRASHED"
fi
i=`expr $i + 1`
done
fi
} 2>&1 | tee -a results.${NAME}
}
make_src_code ()
{
prelude="${SRC}/${NAME}-prelude.scm"
postlude="${SRC}/${NAME}-postlude.scm"
if [ -e "$prelude" ]
then
echo "Including prelude $prelude"
else
prelude="/dev/null"
fi
if [ -e "$postlude" ]
then
echo "Including postlude $postlude"
else
postlude="/dev/null"
fi
cat "$prelude" "${SRC}/$1.scm" "${SRC}/common.scm" "$postlude" "${SRC}/common-postlude.scm" > "${TEMP}/$1.${EXTENSION}"
}
# -----------------------------------------------------------------------------
# Definitions specific to Larceny and Petit Larceny
#
# The --nocontract command-line option reduces variability
# of timing, and probably corresponds to the default for
# most other systems.
larceny_comp ()
{
:
}
larceny_exec ()
{
# add srfi 112 for (implementation-version)
sed -i 's/^(import /(import (srfi 112) /' $1
time "${LARCENY}" --nocontract --r7rs --program "$1" < "$2"
}
petit_comp ()
{
rm "`dirname "$1"`"/*.slfasl
rm "`dirname "$1"`"/*.slfasl.c
rm "`dirname "$1"`"/*.slfasl.o
rm "`dirname "$1"`"/*.slfasl.so
rm "`dirname "$1"`"/*.slfasl.*.so
echo "(import (larceny compiler)) (compile-file \"$1\")" \
| time "${PETIT}" -err5rs -- -e "(repl-prompt values)"
}
petit_exec ()
{
time "${PETIT}" --nocontract --r7rs --program "$1" < "$2"
}
henchman_comp ()
{
echo "(import (larceny compiler)) (compile-file \"$1\")" \
| time "${HENCHMAN}" -err5rs -- -e "(repl-prompt values)"
}
henchman_exec ()
{
time "${HENCHMAN}" --nocontract --r7rs --program "$1" < "$2"
}
# -----------------------------------------------------------------------------
# Definitions specific to Chibi
chibi_comp ()
{
:
}
chibi_exec ()
{
time "${CHIBI}" -m scheme.load -e "(load \"$1\")" < "$2"
}
# -----------------------------------------------------------------------------
# Definitions specific to Chicken5
chicken_comp ()
{
OPTS="-R r7rs -X r7rs -block -O3 -C -O3 -d0"
${CHICKEN_CSC} ${OPTS} $1 -o $2
}
chicken_exec ()
{
time "$1" < "$2"
}
# -----------------------------------------------------------------------------
# Definitions specific to Chicken 5 CSI
chickencsi_comp ()
{
:
}
chickencsi_exec ()
{
time ${CHICKEN_CSI} "$1" < "$2"
}
# -----------------------------------------------------------------------------
# Definitions specific to Cyclone
cyclone_comp ()
{
${CYCLONE} -no-memoization-optimizations $1
}
cyclone_exec ()
{
time `dirname $1`/`basename $1 .scm` < "$2"
}
# -----------------------------------------------------------------------------
# Definitions specific to Stalin
stalin_comp ()
{
# run through alexpander first
expanded=${1%%scm}exp
echo "(print-brackets #f) (alexpander-repl)" | cat - $1 | sponge $1
chez -q src/alexpander.scm < $1 > $expanded
# ${STALIN} -On -Ob -Om -Or -Ot -d -d1 -k -copt -O3 $expanded
echo "(load \"/home/nex/scheme/chez/stalin/stalin.scm\") (load \"/home/nex/scheme/chez/stalin/stalin.scm\") (test \"$expanded\")" | chez -q
}
stalin_exec ()
{
exe=${1%%.exe}
time ( "$exe" < "$2" )
}
# -----------------------------------------------------------------------------
# Definitions specific to S7
s7_comp ()
{
:
}
s7_exec ()
{
time ${S7} "$1" < "$2"
}
# -----------------------------------------------------------------------------
# Definitions specific to S9fES
s9fes_comp ()
{
:
}
s9fes_exec ()
{
time ${S9fES} "$1" < "$2"
}
# -----------------------------------------------------------------------------
# Definitions specific to SISC
sisc_comp ()
{
:
}
sisc_exec ()
{
time ${SISC} "$1" < "$2"
}
# -----------------------------------------------------------------------------
# Definitions specific to TinyScheme
stklos_comp ()
{
true
}
stklos_exec ()
{
# The "-s 10000000" parameter, which sets a larger stack size, is necessary
# for at least one benchmark (ack)
time ( ${STKLOS} -s 10000000 -f "$1" < "$2" )
}
# -----------------------------------------------------------------------------
# Definitions specific to TinyScheme
tinyscheme_comp ()
{
# remove import statement
sed -i -e 's/^(import (scheme.*)$//g' $1
}
tinyscheme_exec ()
{
sed 's/^(run-benchmark)$/(with-input-from-file (car *args*) run-benchmark)/' -i "$1"
time ( ${TINYSCHEME} -1 "$1" "$2" )
}
# -----------------------------------------------------------------------------
# Definitions specific to TR7
tr7_comp ()
{
:
}
tr7_exec ()
{
time ${TR7I} "$1" < "$2"
}
# -----------------------------------------------------------------------------
# Definitions specific to RScheme
rscheme_comp ()
{
# remove import statement
sed -i -e 's/^(import (scheme.*)$//g' $1
filename=$(basename $1)
dirname=$(dirname $1)
echo "((test \".\" \".\") (open primops *scheme* iolib low-scheme objsys mathlib high-scheme syscalls) (files ${filename%%.scm}) (export run-benchmark))" > $dirname/test.mcf
# cd $dirname
${RSCHEME_RSC} -p $dirname/test.mcf
}
rscheme_exec ()
{
dirname=$(dirname $1)
cp -R inputs $dirname/
cd $dirname
echo "(with-module mlink (push-module-search-path! \".\")) ,(use test)" > run-current-test.scm
time ( ${RSCHEME} run-current-test.scm < "$2" )
rm -Rf test.mif test.mx test.mcf test.doc
}
# -----------------------------------------------------------------------------
# Definitions specific to Rhizome
rhizome_comp ()
{
# remove import statement
sed -i -e 's/^(import (scheme.*)$//g' $1
dir=$(dirname "$1")
cd $dir
infile=$(basename "$1")
outfile=$(basename "$2")
tmpfile=${outfile%exe}c
modulename=${infile%.scm}
echo "${RHIZOME_PISC} -output $tmpfile $infile"
${RHIZOME_PISC} -output $tmpfile $infile
echo "${RHIZOME_PISL} $modulename -o $outfile"
${RHIZOME_PISL} $modulename -o $outfile
chmod +x $outfile
}
rhizome_exec ()
{
# time pi $1 < $2
time "$1" < "$2"
}
# -----------------------------------------------------------------------------
# Definitions specific to Ypsilon
ypsilon_comp ()
{
# remove import statement
sed -i -e 's/^(import (scheme.*)$//g' $1
}
ypsilon_exec ()
{
time ${YPSILON} "$1" < "$2"
}
# -----------------------------------------------------------------------------
# Definitions specific to Scheme48
scheme48_comp ()
{
# don't execute run-benchmark
sed -i -e 's/^(run-benchmark)$//' -e 's/(run-benchmark)/(run-benchmark . unneeded-command-line-parameters)/' $1
echo "echo -e ,set inline-values\n,open srfi-19\n,open big-util\n,open define-record-types\n(load \"$1\")\n,build run-benchmark $2\n,exit | ( time ${SCHEME48} )"
echo -e ",set inline-values\n,open srfi-19\n,open big-util\n,open define-record-types\n(load \"$1\")\n,build run-benchmark $2\n,exit" | ( time ${SCHEME48} )
}
scheme48_exec ()
{
time ${SCHEME48} -h 100000000 -i $1 < $2
}
# -----------------------------------------------------------------------------
# Definitions specific to Bones
bones_comp ()
{
# remove import statement
sed -i -e 's/^(import (scheme.*)$//g' $1
echo "${BONES} $1 > $1.s"
${BONES} $1 > $1.s
echo "nasm -I/usr/share/bones -f elf64 $1.s -o $1.o"
nasm -I/usr/share/bones/ -f elf64 $1.s -o $1.o
echo "gcc $1.o -o $2"
gcc -no-pie $1.o -o $2
}
bones_exec ()
{
time "$1" < "$2"
}
# -----------------------------------------------------------------------------
# Definitions specific to Vicare
vicare_comp ()
{
# remove import statement
sed -i -e 's/^(import (scheme.*)$//g' $1
${VICARE} -c $1 -o $2
}
vicare_exec ()
{
time ${VICARE} --binary-program "$1" < "$2"
}
# -----------------------------------------------------------------------------
# Definitions specific to IronScheme
ironscheme_comp ()
{
:
}
ironscheme_exec ()
{
# remove import statement
sed -i -e 's/^(import (scheme.*)$/(import (rnrs base) (rnrs io simple))/g' $1
# maybe a support lookup table can be added for these, and only inject if needed, like for read-line, square, exact-integer? too
sed -i -e 's/^(define (bitwise-not[[:blank:]].*).*$/#;(excluded/g' $1
sed -i -e 's/^(define (bitwise-and[[:blank:]].*).*$/#;(excluded/g' $1
sed -i -e 's/^(define (div[[:blank:]].*).*$/#;(excluded/g' $1
sed -i -e 's/^(define (mod[[:blank:]].*).*$/#;(excluded/g' $1
# R6RS compat failure: gcbench
# failures due to Mono: cpstak, fft, pi, pnpoly, quicksort
# weird failures: matrix (missing quote?)
time ( ${IRONSCHEME} "$1" < "$2" )
}
# -----------------------------------------------------------------------------
# Definitions specific to Racket
racket_comp ()
{
echo ${RACKET_RACO} make "$1"
${RACKET_RACO} make "$1"
}
racket_exec ()
{
echo time ${RACKET} "$1" < "$2"
time ${RACKET} "$1" < "$2"
}
# -----------------------------------------------------------------------------
# Definitions specific to Bigloo
bigloo_comp ()
{
${BIGLOO} $1 -O6 -call/cc -copt -O3 -o $2
}
bigloo_exec ()
{
time "$1" < "$2"
}
# -----------------------------------------------------------------------------
# Definitions specific to Chez
chez_comp ()
{
:
}
chez_exec ()
{
# remove import statement
# sed -i -e 's/^(import (scheme.*)$//g' $1
time "${CHEZ}" --optimize-level 2 --compile-imported-libraries --libdirs /home/nex/scheme/chez --program "$1" < "$2"
}
# -----------------------------------------------------------------------------
# Definitions specific to Petite Chez
petite_chez_comp ()
{
:
}
petite_chez_exec ()
{
# remove import statement
sed -i -e 's/^(import (scheme.*)$//g' $1
time "${PETITE_CHEZ}" --program "$1" < "$2"
}
# -----------------------------------------------------------------------------
# Definitions specific to MIT/GNU Scheme
mit_comp ()
{
echo "(begin (cf \"$1\") (%exit 0))" | ${MIT} --quiet --heap 500000
}
mit_exec ()
{
time ${MIT} --quiet --heap 500000 --load "$1" < "$2"
}
# -----------------------------------------------------------------------------
# Definitions specific to Guile Scheme 3
guile_comp ()
{
# Guile's default optimization level is more suited to interactive
# development. Explicitly selecting -O3 allows it to more
# aggressively inline top-level definitions.
${GUILD} compile -O3 "$1"
}
guile_exec ()
{
time ${GUILE} "$1" < "$2"
}
# -----------------------------------------------------------------------------
# Definitions specific to Gambit Scheme
gambitc_comp ()
{
# remove import statement
sed -i -e 's/^(import (scheme.*)$//g' $1
${GAMBITC} -o $2 -exe $1
}
gambitc_exec ()
{
time "$1" < "$2"
}
# -----------------------------------------------------------------------------
# Definitions specific to femtolisp
femtolisp_comp ()
{
:
}
femtolisp_exec ()
{
time "${FEMTOLISP}" "$1" < "$2"
}
# -----------------------------------------------------------------------------
# Definitions specific to Foment
foment_comp ()
{
:
}
foment_exec ()
{
time "${FOMENT}" "$1" < "$2"
}
# -----------------------------------------------------------------------------
# Definitions specific to Gauche
gauche_comp ()
{
:
}
gauche_exec ()
{
time "${GAUCHE}" -r7 -b "$1" < "$2"
}
# -----------------------------------------------------------------------------
# Definitions specific to Gerbil
gerbil_comp ()
{
sed -i -e 's/^(run-benchmark)$//' $1
${GXC} -d $(dirname "$1") -exe -O -o "${1%.scm}.exe" "$1"
}
gerbil_exec ()
{
export GERBIL_HOME=/opt/gerbil/
time "$1" < "$2"
}
# -----------------------------------------------------------------------------
# Definitions specific to Husk
# I could not get huskc to work:
#
# % ./huskc /tmp/r7rs-benchmarks/fib.scm
#
# /tmp/r7rs-benchmarks/fib.hs:14:8:
# Could not find module `Language.Scheme.Variables'
# Use -v to see a list of the files searched for.
husk_comp ()
{
:
}
husk_exec ()
{
time "${HUSKI}" "$1" < "$2"
}
# -----------------------------------------------------------------------------
# Definitions specific to Kawa
kawa_comp ()
{
classname=$(basename -s .scm $1)
"${KAWA}" --r7rs --no-warn-unused -d out --main -T $classname -C $1
}
kawa_exec ()
{
classname=$(basename -s .scm $1)
time "${JAVA}" -cp $KAWAJAR:$(dirname $0)/out $classname < "$2"
}
# -----------------------------------------------------------------------------
# Definitions specific to Mosh
mosh_comp ()
{
:
}
mosh_exec ()
{
sed -i 's/(scheme time)/(only (scheme time) current-jiffy current-second)/' "$1"
time "${MOSH}" "$1" < "$2"
}
# -----------------------------------------------------------------------------
# Definitions specific to Owl-Lisp
owllisp_comp ()
{
:
}
owllisp_exec ()
{
echo "${OL} $1 < $2"
time "${OL}" "$1" < "$2"
}
# -----------------------------------------------------------------------------
# Definitions specific to Picrin
# Picrin (apparently) does not allow forward references within
# procedure definitions, so it is unable to run any of these
# benchmarks.
picrin_comp ()
{
:
}
picrin_exec ()
{
time "${PICRIN}" "$1" < "$2"
}
# -----------------------------------------------------------------------------
# Definitions specific to Sagittarius
sagittarius_comp ()
{
:
}
sagittarius_exec ()
{
time "${SAGITTARIUS}" -r7 -d -n "$1" < "$2"
}
# -----------------------------------------------------------------------------
# Definitions specific to Loko
loko_comp ()
{
${LOKO} -std=r7rs -ftarget=linux --compile $1 --output $2
}
loko_exec ()
{
time "$1" < "$2"
}
# -----------------------------------------------------------------------------
## Arg processing...
if [ "$#" -lt 2 ]; then
error '>>> At least two command line arguments are needed'
fi
while [ $# -gt 2 ] ; do
arg="$1"
shift
case $arg in
-r) NB_RUNS=$1 ; shift ;;
-c) clean=$1 ; shift ;;
-o) options=$1 ; shift ;;
*) error ">>> Unknown argument of $arg given." ;;
esac
done
if [ "$#" -ne 2 ]; then
error '>>> Last two arguments must be <system> and <benchmark>'
fi
case "$1" in
all) systems="$ALL_SYSTEMS" ;;
*) systems="$1" ;;
esac
case "$2" in
all) benchmarks="$ALL_BENCHMARKS" ;;
gabriel) benchmarks="$GABRIEL_BENCHMARKS" ;;
kvw) benchmarks="$KVW_BENCHMARKS" ;;
other) benchmarks="$OTHER_BENCHMARKS" ;;
awk) benchmarks="$AWK_BENCHMARKS" ;;
c) benchmarks="$C_BENCHMARKS" ;;
java) benchmarks="$JAVA_BENCHMARKS" ;;
*) benchmarks="$2" ;;
esac
## Run each benchmark under each system...
for system in $systems ; do
case "$system" in
larceny) NAME='Larceny'
COMP=larceny_comp
EXEC=larceny_exec
COMPOPTS=""
EXTENSION="scm"
EXTENSIONCOMP="scm"
COMPCOMMANDS=""
EXECCOMMANDS=""
;;
petit) NAME='Petit'
COMP=petit_comp
EXEC=petit_exec
COMPOPTS=""
EXTENSION="scm"
EXTENSIONCOMP="slfasl"
COMPCOMMANDS=""
EXECCOMMANDS=""
;;
henchman) NAME='Henchman'
COMP=henchman_comp
EXEC=henchman_exec
COMPOPTS=""
EXTENSION="scm"
EXTENSIONCOMP="slfasl"
COMPCOMMANDS=""
EXECCOMMANDS=""
;;
chibi) NAME='Chibi'
COMP=chibi_comp
EXEC=chibi_exec
COMPOPTS=""
EXTENSION="scm"
EXTENSIONCOMP="scm"
COMPCOMMANDS=""
EXECCOMMANDS=""
;;
chicken) NAME='Chicken'
COMP=chicken_comp
EXEC=chicken_exec
COMPOPTS=""
EXTENSION="scm"
EXTENSIONCOMP="exe"
COMPCOMMANDS=""
EXECCOMMANDS=""
;;
chickencsi) NAME='ChickenCSI'
COMP=chickencsi_comp