Changeset 12162 in project


Ignore:
Timestamp:
10/15/08 01:10:10 (12 years ago)
Author:
felix winkelmann
Message:

tweaks in cscbench.scm

Location:
chicken/branches/cmi
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • chicken/branches/cmi/TODO

    r12151 r12162  
    4545
    4646* benchmarks
    47 ** get rid of cscbench, hack together something simpler
    48 ** simplify comparing two builds relative to each other
    49 ** simplify passing extra options
     47** add more realistic benchmarks
    5048
    5149* tests
  • chicken/branches/cmi/benchmarks/cscbench.scm

    r12152 r12162  
    55(require-extension srfi-1 utils posix regex)
    66
     7(define ignored-files '("cscbench.scm"))
    78(define flonum-files '("fft" "maze"))
    8 
    99(define cc "`csc -cc-name`")
    1010(define chicken "chicken")
     
    4646        (display-r fs 3 #\0) ) ) ) )
    4747
     48(define (display-size n)
     49  (display-r
     50   (string-append (number->string (quotient n 1024)) "k")
     51   10 #\space))
     52
    4853(define (compile-and-run file decls options coptions unsafe)
    4954  (system* "~A ~A -quiet -no-warnings -heap-size 8m -output-file tmpfile.c ~A ~A"
    5055           chicken file decls options)
    51   (system* "~a ~a -static -I.. tmpfile.c -o tmpfile ../lib~achicken.a -lm"
    52            cc coptions (if unsafe "u" ""))
    53   (let ([time (call-with-current-continuation
     56  (system* "~a ~a -s -I.. tmpfile.c -o tmpfile ../lib~achicken.a -lm"
     57           cc coptions
     58           (if unsafe "u" ""))
     59  (let ((time (call-with-current-continuation
    5460               (lambda (abort)
    5561                 (set! abort-run (cut abort #f))
    56                  (/ (+ (run) (run) (run)) 3) ) ) ] )
     62                 (/ (+ (run) (run) (run) (run) (run)) 5) ) ) )
     63        (size (file-size "tmpfile")))
    5764    (display #\space)
    5865    (cond (time
    5966            (display-f-4.3 time)
    60             time)
     67            (values time size))
    6168          (else
    6269            (display "FAILED")
    63             9999.9))))
     70            (values 9999.9 size)))))
    6471
    6572(define (dflush x)
     
    8895  (dflush "\nCFLAGS:\n")
    8996  (system* "echo `csc -cflags`")
    90   (display "\n                     base     unsafe        max\n")
     97  (display "\n(Running benchmarks - average over 5 runs, statically linked, stripped)\n")
     98  (display "\n                     (runtime)                      (code size)\n")
     99  (display "\n                     base     unsafe        max     base     unsafe       max")
     100  (display "\n                  -------------------------------------------------------------\n")
    91101  (let ((sum-base 0.0)
    92102        (sum-unsafe 0.0)
    93         (sum-max 0.0))
    94   (for-each
    95    (lambda (file)
    96      (let* ([name (pathname-file file)]
    97             [options (string-intersperse options " ")] )
    98        (display-l name 16 #\space)
    99        (flush-output)
    100        (set! sum-base (+ sum-base (compile-and-run file "-debug-level 0 -optimize-level 1 -lambda-lift" options "" #f)))
    101        (dflush "  ")
    102        (set! sum-unsafe (+ sum-unsafe (compile-and-run file "-debug-level 0 -optimize-level 3 -block -disable-interrupts -lambda-lift" options "" #t)))
    103        (dflush "  ")
    104        (unless (member name flonum-files)
    105          (set! sum-max (+ sum-max (compile-and-run file "-benchmark-mode" options "" #t) )))
    106        (newline)
    107        (flush-output) ) )
    108    (lset-difference string=? (sort (glob "*.scm") string<?) '("cscbench.scm")))
    109   (display "\nTOTAL            ")
    110   (display-f-4.3 sum-base)
    111   (display "   ")
    112   (display-f-4.3 sum-unsafe)
    113   (display "   ")
    114   (display-f-4.3 sum-max)
    115   (newline)
    116  0))
     103        (sum-max 0.0)
     104        (size-base 0)
     105        (size-unsafe 0)
     106        (size-max 0))
     107    (for-each
     108     (lambda (file)
     109       (let* ([name (pathname-file file)]
     110              [options (string-intersperse options " ")]
     111              (t 0))
     112         (display-l name 16 #\space)
     113         (flush-output)
     114         (set!-values
     115          (t size-base)
     116          (compile-and-run
     117           file
     118           "-debug-level 0 -optimize-level 1 -lambda-lift"
     119           options "" #f))
     120         (set! sum-base (+ sum-base t))
     121         (dflush "  ")
     122         (set!-values
     123          (t size-unsafe)
     124          (compile-and-run
     125           file
     126           "-debug-level 0 -optimize-level 3 -block -disable-interrupts -lambda-lift"
     127           options "" #t))
     128         (set! sum-unsafe (+ sum-unsafe t))
     129         (dflush "  ")
     130         (unless (member name flonum-files)
     131           (set!-values
     132            (t size-max)
     133            (compile-and-run file "-benchmark-mode" options "" #t) )
     134           (set! sum-max (+ sum-max t)))
     135         (display-size size-base)
     136         (display-size size-unsafe)
     137         (display-size size-max)
     138         (newline)
     139         (flush-output)))
     140     (lset-difference string=? (sort (glob "*.scm") string<?) ignored-files))
     141    (display "\nTOTAL            ")
     142    (display-f-4.3 sum-base)
     143    (display "   ")
     144    (display-f-4.3 sum-unsafe)
     145    (display "   ")
     146    (display-f-4.3 sum-max)
     147    (newline)
     148    0))
    117149
    118150(main (command-line-arguments))
Note: See TracChangeset for help on using the changeset viewer.