Changeset 39365 in project


Ignore:
Timestamp:
11/24/20 02:21:41 (5 months ago)
Author:
Kon Lovett
Message:

label intermediate calcs, follow pattern, remove "outer" iter count

Location:
release/5/micro-benchmark/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • release/5/micro-benchmark/trunk/micro-benchmark.egg

    r39363 r39365  
    11((synopsis "easily create micro-benchmarks")
    2  (version "0.0.2")
     2 (version "0.0.3")
    33 (author "David Krentzlin")
    44 (maintainer "[[kon lovett]]")
  • release/5/micro-benchmark/trunk/micro-benchmark.scm

    r39363 r39365  
    315315      ((per-100ms _) (iterations-per-100ms thunk (secs->ms warmups)))
    316316      ((threshold) (+ (*realtime-microsecs) (secs->ÎŒs seconds))) )
    317       (let loop (#;(iterations (the fixnum 0)) (timings (list)))
     317      (let loop ((timings (list)))
    318318        (if (< (*realtime-microsecs) threshold)
    319319          (let ((before (*realtime-microsecs)))
    320             ;NOTE this will run at least once, so long as per-100ms > 0
    321320            (dotimes (_ per-100ms) (thunk))
    322             (let ((after (*realtime-microsecs)))
    323               (loop #;(+ iterations per-100ms) (cons (- after before (* per-100ms *iterations-overhead*)) timings))))
    324           (map (lambda (i) (/ per-100ms (ÎŒs->secs i))) timings) ) ) ) ) )
     321            (let* (
     322              (after (*realtime-microsecs))
     323              (overhead (* per-100ms *iterations-overhead*))
     324              (total-time (- after before overhead)) )
     325              (loop (cons total-time timings)) ) )
     326          (map (lambda (t) (/ per-100ms (ÎŒs->secs t))) timings) ) ) ) ) )
    325327
    326328;@thunk benchmark procedure
     
    329331(define (iterations-per-100ms thunk limit)
    330332  (let* (
    331     (before (*realtime-microsecs))
    332     (threshold (+ before (ms->ÎŒs limit))) )
     333    (threshold (+ (*realtime-microsecs) (ms->ÎŒs limit)))
     334    (before (*realtime-microsecs)) )
    333335    (let loop ((iterations (the fixnum 0)))
    334336      (let ((after (*realtime-microsecs)))
Note: See TracChangeset for help on using the changeset viewer.