Skip to content

Instantly share code, notes, and snippets.

@samdphillips
Created February 23, 2022 18:53
Show Gist options
  • Save samdphillips/4bbba8ad343088ced0d06b22699dd343 to your computer and use it in GitHub Desktop.
Save samdphillips/4bbba8ad343088ced0d06b22699dd343 to your computer and use it in GitHub Desktop.
#lang racket/base
(module stack racket/base
(provide build-it)
(define (build-it n)
(if (zero? n)
null
(cons n (build-it (sub1 n))))))
(module accumulate racket/base
(provide build-it)
(define (build-it n)
(define (loop n acc)
(if (zero? n)
(reverse acc)
(loop (sub1 n) (cons n acc))))
(loop n null)))
(define bench (string->symbol (vector-ref (current-command-line-arguments) 0)))
(define count (string->number (vector-ref (current-command-line-arguments) 1)))
(define f
(dynamic-require `(submod "microbench-list.rkt" ,bench) 'build-it))
(time (void (f count)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment