Skip to content

Instantly share code, notes, and snippets.

@dyoo
Created February 27, 2013 23:14
Show Gist options
  • Save dyoo/5052730 to your computer and use it in GitHub Desktop.
Save dyoo/5052730 to your computer and use it in GitHub Desktop.
performance test on compiling for the repl
#lang racket/base
(define this-namespace (make-base-empty-namespace))
(define (make-repl-namespace [module-path 'racket/base])
(parameterize ([current-namespace this-namespace])
(dynamic-require module-path #f))
(define ns (make-empty-namespace))
(parameterize ([current-namespace ns])
(namespace-attach-module this-namespace module-path)
(namespace-require/copy module-path))
ns)
(define (repl-compile body #:lang [module-path 'racket/base])
(parameterize ([current-namespace (make-repl-namespace module-path)])
(compile body)))
(for ([i 10])
(time (repl-compile '(* x 3) #:lang 'lang/htdp-beginner)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment