Changeset 39365 in project
- Timestamp:
- 11/24/20 02:21:41 (2 months ago)
- Location:
- release/5/micro-benchmark/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
release/5/micro-benchmark/trunk/micro-benchmark.egg
r39363 r39365 1 1 ((synopsis "easily create micro-benchmarks") 2 (version "0.0. 2")2 (version "0.0.3") 3 3 (author "David Krentzlin") 4 4 (maintainer "[[kon lovett]]") -
release/5/micro-benchmark/trunk/micro-benchmark.scm
r39363 r39365 315 315 ((per-100ms _) (iterations-per-100ms thunk (secs->ms warmups))) 316 316 ((threshold) (+ (*realtime-microsecs) (secs->ÎŒs seconds))) ) 317 (let loop ( #;(iterations (the fixnum 0))(timings (list)))317 (let loop ((timings (list))) 318 318 (if (< (*realtime-microsecs) threshold) 319 319 (let ((before (*realtime-microsecs))) 320 ;NOTE this will run at least once, so long as per-100ms > 0321 320 (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) ) ) ) ) ) 325 327 326 328 ;@thunk benchmark procedure … … 329 331 (define (iterations-per-100ms thunk limit) 330 332 (let* ( 331 ( before (*realtime-microsecs))332 ( threshold (+ before (ms->ÎŒs limit))) )333 (threshold (+ (*realtime-microsecs) (ms->ÎŒs limit))) 334 (before (*realtime-microsecs)) ) 333 335 (let loop ((iterations (the fixnum 0))) 334 336 (let ((after (*realtime-microsecs)))
Note: See TracChangeset
for help on using the changeset viewer.