From b550ae9b7394dbce5afe05b59d3f447f67dd50f6 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Mon, 22 Jan 2007 03:18:51 +0000 Subject: [PATCH] mostly improvements to run.ss benchmark-running script svn: r5423 --- .../benchmarks/shootout/reversecomplement.ss | 2 +- .../tests/mzscheme/benchmarks/shootout/run.ss | 102 +- .../benchmarks/shootout/sumcol-input.txt | 1000 +++++++++++++++++ 3 files changed, 1076 insertions(+), 28 deletions(-) create mode 100644 collects/tests/mzscheme/benchmarks/shootout/sumcol-input.txt diff --git a/collects/tests/mzscheme/benchmarks/shootout/reversecomplement.ss b/collects/tests/mzscheme/benchmarks/shootout/reversecomplement.ss index 6c40fda020..cea3886c7e 100644 --- a/collects/tests/mzscheme/benchmarks/shootout/reversecomplement.ss +++ b/collects/tests/mzscheme/benchmarks/shootout/reversecomplement.ss @@ -43,7 +43,7 @@ (if (eof-object? l) (output accum) (cond - [(regexp-match #rx#"^>" l) + [(regexp-match? #rx#"^>" l) (output accum) (printf "~a\n" l) (loop null)] diff --git a/collects/tests/mzscheme/benchmarks/shootout/run.ss b/collects/tests/mzscheme/benchmarks/shootout/run.ss index 33fd8bc1fd..6894e9b8fd 100644 --- a/collects/tests/mzscheme/benchmarks/shootout/run.ss +++ b/collects/tests/mzscheme/benchmarks/shootout/run.ss @@ -1,54 +1,102 @@ (module run mzscheme (define input-map - '( - ("ackermann.ss" . "11") - ("ary.ss" . "9000") - ("binarytrees.ss" . "16") + `( + ("ackermann.ss" "11") + ("ary.ss" "9000") + ("binarytrees.ss" "16") ("chameneos.ss") ("cheapconcurrency.ss") - ("echo.ss" . "150000") - ("except.ss" . "2500000") - ("fannkuch.ss" . "10") - ("fasta.ss") - ("fibo.ss" . "32") - ("hash.ss" . "100000") - ("hash2.ss" . "200") - ("heapsort.ss" . "100000") - ("lists.ss" . "18") + ("echo.ss" "150000") + ("except.ss" "2500000") + ("fannkuch.ss" "10") + ("fasta.ss" "25000000") + ("fibo.ss" "32") + ("hash.ss" "100000") + ("hash2.ss" "200") + ("heapsort.ss" "100000") + ("lists.ss" "18") ("mandelbrot.ss") - ("matrix.ss" . "600") - ("moments.ss") 200 somethings... + ("matrix.ss" "600") + ("moments.ss") ; 200 somethings... ("nbody.ss") - ("nestedloop.ss" . "18") + ("nestedloop.ss" "18") ("nsieve.ss") ("nsievebits.ss") ("partialsums.ss") ("pidigits.ss") ("pidigits1.ss") - ("random.ss" . "900000") + ("random.ss" "900000") ("recursive.ss") ("regexmatch.ss") ("regexpdna.ss") - ("reversecomplement.ss") + ("reversecomplement.ss" #f ,(lambda () (mk-revcomp-input))) ("reversefile.ss") - ("sieve.ss" . "1200") + ("sieve.ss" "1200") ("spellcheck.ss") - ("strcat.ss" . "40000") - ("sumcol.ss") + ("strcat.ss" "40000") + ("sumcol.ss" #f ,(lambda () (mk-sumcol-input))) ("wc.ss") ("wordfreq.ss") )) - (let ([len (vector-length (current-command-line-arguments))]) - (unless (= 1 len) - (error 'run "provide ~athe name of a benchmark on the command line" - (if (zero? len) "" "ONLY ")))) + (define (dynreq f) + (dynamic-require `(lib ,f "tests" "mzscheme" "benchmarks" "shootout") #f)) + (define (mk-revcomp-input) + (let ([f (build-path (find-system-path 'temp-dir) "fasta-2m5")]) + (unless (file-exists? f) + (printf "Building FASTA 2,500,000 output for input: ~a\n" f) + (with-output-to-file f + (lambda () + (parameterize ([current-command-line-arguments (vector "2500000")]) + (dynreq "fasta.ss"))))) + f)) + + (define (mk-sumcol-input) + (let ([f (build-path (find-system-path 'temp-dir) "sumcol-21k")]) + (unless (file-exists? f) + (printf "Building sumcol 21000 input: ~a\n" f) + (let ([c (with-input-from-file (build-path (collection-path "tests") + "mzscheme" + "benchmarks" + "shootout" + "sumcol-input.txt") + (lambda () + (read-bytes 10000)))]) + (with-output-to-file f + (lambda () + (let loop ([n 21000]) + (unless (zero? n) + (printf "~a" c) + (loop (sub1 n)))))))) + f)) + + (define iters + (let ([len (vector-length (current-command-line-arguments))]) + (unless (<= 1 len 2) + (error 'run "provide ~athe name of a benchmark on the command line and an optional iteration count" + (if (zero? len) "" "ONLY "))) + (if (= len 2) + (string->number (vector-ref (current-command-line-arguments) 1)) + 1))) + (let ([prog (vector-ref (current-command-line-arguments) 0)]) (let ([m (assoc prog input-map)]) (unless m (error 'run "cannot find input for ~a" prog)) (when (null? (cdr m)) (error 'run "don't know input for ~a" prog)) - (parameterize ([current-command-line-arguments (vector (cdr m))]) - (time (dynamic-require prog #f)))))) + (let loop ([n iters]) + (parameterize ([current-command-line-arguments + (if (cadr m) + (vector (cadr m)) + (vector))] + [current-input-port + (if (null? (cddr m)) + (current-input-port) + (open-input-file ((caddr m))))]) + (parameterize ([current-namespace (make-namespace)]) + (collect-garbage) + (time (dynreq prog)))) + (unless (= n 1) + (loop (sub1 n))))))) diff --git a/collects/tests/mzscheme/benchmarks/shootout/sumcol-input.txt b/collects/tests/mzscheme/benchmarks/shootout/sumcol-input.txt new file mode 100644 index 0000000000..956aba1447 --- /dev/null +++ b/collects/tests/mzscheme/benchmarks/shootout/sumcol-input.txt @@ -0,0 +1,1000 @@ +276 +498 +-981 +770 +-401 +702 +966 +950 +-853 +-53 +-293 +604 +288 +892 +-697 +204 +96 +408 +880 +-7 +-817 +422 +-261 +-485 +-77 +826 +184 +864 +-751 +626 +812 +-369 +-353 +-371 +488 +-83 +-659 +24 +524 +-21 +840 +-757 +-17 +-973 +-843 +260 +858 +-389 +-521 +-99 +482 +-561 +-213 +630 +766 +932 +112 +-419 +-877 +762 +266 +-837 +170 +834 +746 +764 +922 +-89 +576 +-63 +90 +684 +316 +506 +-959 +708 +70 +252 +-747 +342 +-593 +-895 +-937 +-707 +350 +588 +-201 +-683 +-113 +-511 +-867 +322 +202 +472 +150 +-9 +-643 +28 +336 +86 +-925 +836 +-473 +-451 +-971 +-805 +-619 +84 +-67 +806 +270 +366 +334 +-555 +-557 +-331 +-409 +-553 +-145 +-71 +528 +490 +492 +828 +628 +-961 +536 +-859 +-271 +974 +-671 +-749 +414 +-257 +778 +56 +598 +-437 +-899 +-785 +-987 +32 +-999 +132 +-821 +-209 +402 +-543 +194 +-967 +294 +-943 +-285 +-483 +-97 +660 +-481 +-829 +-309 +-597 +-855 +80 +-355 +192 +-823 +436 +916 +282 +-629 +612 +-329 +-535 +780 +-47 +706 +110 +756 +-857 +-933 +-345 +-523 +718 +-31 +902 +678 +540 +698 +456 +-399 +126 +412 +-563 +-321 +-487 +-641 +-195 +-199 +-955 +772 +570 +18 +-217 +886 +984 +-721 +-995 +46 +-989 +946 +64 +716 +-719 +-869 +-579 +776 +450 +936 +980 +-439 +-977 +-455 +-997 +6 +268 +-269 +-421 +328 +352 +578 +-575 +476 +976 +-57 +-469 +544 +582 +-43 +510 +-939 +-581 +-337 +-203 +-737 +-827 +852 +-279 +-803 +-911 +-865 +548 +48 +-75 +416 +-275 +688 +-255 +-687 +-461 +-233 +420 +912 +-901 +-299 +12 +568 +694 +-411 +-883 +-327 +-361 +-339 +646 +-137 +-905 +670 +686 +-131 +-849 +-825 +256 +228 +-841 +68 +368 +-909 +242 +298 +118 +10 +222 +954 +-493 +-459 +-445 +608 +-765 +34 +468 +-715 +690 +-185 +-551 +-571 +-241 +292 +92 +768 +-923 +956 +614 +8 +730 +208 +-417 +300 +136 +-59 +-251 +-539 +166 +798 +866 +454 +-391 +-317 +668 +502 +-15 +994 +854 +-189 +666 +446 +-565 +-5 +42 +-227 +-87 +-779 +26 +312 +354 +754 +396 +-515 +220 +872 +654 +88 +-667 +250 +572 +952 +72 +982 +972 +-529 +-471 +-533 +-427 +538 +154 +-457 +-819 +750 +152 +452 +-41 +838 +-489 +418 +-649 +-637 +-197 +74 +394 +-653 +-727 +-435 +-23 +348 +638 +-611 +914 +-357 +-743 +-685 +580 +-247 +-577 +54 +-931 +-3 +558 +-793 +-443 +-759 +162 +-811 +384 +720 +-117 +900 +-519 +-39 +744 +432 +286 +-873 +380 +-167 +-283 +430 +-155 +-755 +206 +100 +364 +-677 +332 +-567 +382 +-605 +-181 +676 +-475 +-845 +910 +546 +14 +398 +616 +-769 +424 +992 +-235 +-239 +774 +478 +-919 +168 +-771 +-773 +-69 +-509 +930 +550 +-463 +178 +-861 +-761 +-795 +234 +-831 +-61 +-979 +-851 +-665 +-709 +896 +742 +-123 +590 +-693 +-887 +-379 +144 +-717 +20 +174 +82 +464 +30 +-969 +-349 +-531 +-799 +-661 +-647 +-623 +878 +148 +-545 +238 +-259 +554 +726 +-37 +-797 +98 +78 +-591 +-975 +962 +120 +906 +-207 +656 +-171 +652 +188 +672 +-133 +-91 +224 +818 +-333 +-839 +-499 +22 +-739 +142 +378 +-403 +-315 +370 +284 +122 +230 +-527 +-127 +442 +534 +160 +722 +262 +-657 +304 +258 +-103 +960 +-495 +-265 +634 +-101 +480 +-363 +308 +76 +-949 +-585 +904 +146 +-703 +164 +850 +246 +732 +-725 +566 +274 +-163 +-935 +-681 +-229 +254 +-733 +-547 +-273 +-903 +736 +-711 +794 +392 +-655 +-549 +808 +-429 +484 +-701 +-617 +804 +36 +-775 +-335 +-927 +714 +-177 +-325 +-413 +-963 +114 +-253 +-789 +-645 +40 +434 +898 +924 +-19 +738 +788 +280 +-121 +594 +-913 +426 +816 +-373 +-45 +340 +-109 +-323 +58 +-249 +940 +-297 +988 +998 +-607 +-745 +-633 +-115 +996 +-893 +696 +400 +848 +500 +-263 +562 +-807 +-105 +-603 +658 +-73 +-863 +448 +680 +-157 +-161 +728 +814 +-477 +-375 +1000 +-631 +-991 +362 +156 +-187 +-705 +-917 +-449 +-741 +556 +440 +-589 +-11 +-359 +-891 +-801 +-153 +-381 +938 +-173 +-243 +618 +-599 +-497 +486 +128 +790 +460 +-27 +-305 +-205 +-215 +324 +-341 +50 +458 +52 +-621 +874 +386 +560 +-569 +-51 +802 +786 +920 +-425 +466 +444 +-507 +-915 +346 +622 +-679 +784 +-689 +388 +508 +-613 +-313 +-447 +564 +-897 +-211 +-225 +-615 +-367 +186 +894 +-65 +-453 +-245 +602 +496 +-651 +-601 +820 +226 +-695 +-119 +372 +180 +94 +214 +542 +648 +-871 +592 +584 +824 +796 +374 +-945 +-311 +516 +942 +-221 +-433 +200 +-465 +-953 +870 +868 +-879 +518 +356 +-223 +682 +990 +-191 +-541 +-951 +-921 +-319 +-169 +-291 +-289 +792 +876 +306 +-491 +326 +-885 +62 +514 +-929 +318 +-231 +632 +44 +-107 +644 +-267 +-343 +-847 +934 +734 +-505 +-351 +574 +-627 +636 +-93 +-431 +-835 +428 +-183 +-151 +2 +-813 +-595 +958 +-141 +692 +-385 +610 +-179 +376 +948 +198 +-675 +964 +-907 +918 +-165 +-1 +406 +748 +-111 +532 +-55 +-281 +740 +504 +236 +-29 +662 +-713 +-537 +196 +-587 +822 +-135 +700 +-35 +674 +-407 +240 +-673 +-669 +-393 +470 +-525 +-875 +-383 +-625 +296 +-85 +-147 +-277 +800 +-691 +-143 +16 +-983 +-303 +290 +-139 +172 +320 +512 +596 +640 +664 +-791 +-783 +-387 +-735 +-467 +-301 +810 +134 +216 +278 +176 +606 +140 +-787 +978 +586 +890 +882 +-753 +-13 +970 +-941 +-175 +-777 +-809 +-441 +-347 +-377 +390 +-423 +842 +642 +190 +302 +438 +704 +310 +-49 +124 +-781 +-287 +724 +-767 +830 +620 +-295 +244 +-159 +-307 +-397 +66 +-237 +314 +-79 +624 +710 +272 +-365 +928 +856 +138 +-479 +520 +832 +862 +760 +846 +-81 +106 +-513 +-193 +650 +782 +-517 +944 +218 +712 +-663 +-559 +462 +-635 +-25 +182 +530 +844 +330 +-833 +102 +-881 +108 +-947 +-763 +-405 +232 +410 +104 +-729 +-149 +-889 +888 +360 +968 +908 +116 +-815 +-129 +522 +-723 +-993 +860 +-503 +926 +-219 +-415 +60 +158 +-609 +-501 +986 +-699 +-583 +884 +212 +210 +-957 +526 +-985 +552 +344 +-395 +-95 +338 +248 +494 +130 +404 +358 +600 +-639 +-125 +-33 +-965 +752 +474 +-731 +758 +-573 +4 +38 +264